mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
[Script] Strip pango markup when matching rows (#1795)
This is effectively the same fix that was made to DMenu in
a42e9f869f
.
This commit is contained in:
parent
fb7c8c71ef
commit
215e55408f
1 changed files with 26 additions and 12 deletions
|
@ -444,12 +444,21 @@ static char *_get_display_value(const Mode *sw, unsigned int selected_line,
|
||||||
static int script_token_match(const Mode *sw, rofi_int_matcher **tokens,
|
static int script_token_match(const Mode *sw, rofi_int_matcher **tokens,
|
||||||
unsigned int index) {
|
unsigned int index) {
|
||||||
ScriptModePrivateData *rmpd = sw->private_data;
|
ScriptModePrivateData *rmpd = sw->private_data;
|
||||||
|
/** Strip out the markup when matching. */
|
||||||
|
char *esc = NULL;
|
||||||
|
if (rmpd->do_markup) {
|
||||||
|
pango_parse_markup(rmpd->cmd_list[index].entry, -1, 0, NULL, &esc, NULL,
|
||||||
|
NULL);
|
||||||
|
} else {
|
||||||
|
esc = rmpd->cmd_list[index].entry;
|
||||||
|
}
|
||||||
|
if (esc) {
|
||||||
int match = 1;
|
int match = 1;
|
||||||
if (tokens) {
|
if (tokens) {
|
||||||
for (int j = 0; match && tokens[j] != NULL; j++) {
|
for (int j = 0; match && tokens[j] != NULL; j++) {
|
||||||
rofi_int_matcher *ftokens[2] = {tokens[j], NULL};
|
rofi_int_matcher *ftokens[2] = {tokens[j], NULL};
|
||||||
int test = 0;
|
int test = 0;
|
||||||
test = helper_token_match(ftokens, rmpd->cmd_list[index].entry);
|
test = helper_token_match(ftokens, esc);
|
||||||
if (test == tokens[j]->invert && rmpd->cmd_list[index].meta) {
|
if (test == tokens[j]->invert && rmpd->cmd_list[index].meta) {
|
||||||
test = helper_token_match(ftokens, rmpd->cmd_list[index].meta);
|
test = helper_token_match(ftokens, rmpd->cmd_list[index].meta);
|
||||||
}
|
}
|
||||||
|
@ -459,8 +468,13 @@ static int script_token_match(const Mode *sw, rofi_int_matcher **tokens,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (rmpd->do_markup) {
|
||||||
|
g_free(esc);
|
||||||
|
}
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
static char *script_get_message(const Mode *sw) {
|
static char *script_get_message(const Mode *sw) {
|
||||||
ScriptModePrivateData *pd = sw->private_data;
|
ScriptModePrivateData *pd = sw->private_data;
|
||||||
return g_strdup(pd->message);
|
return g_strdup(pd->message);
|
||||||
|
|
Loading…
Reference in a new issue