1
0
Fork 0
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:
Tim Pope 2023-01-29 15:30:36 -05:00 committed by GitHub
parent fb7c8c71ef
commit 215e55408f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,
unsigned int index) {
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;
if (tokens) {
for (int j = 0; match && tokens[j] != NULL; j++) {
rofi_int_matcher *ftokens[2] = {tokens[j], NULL};
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) {
test = helper_token_match(ftokens, rmpd->cmd_list[index].meta);
}
@ -459,7 +468,12 @@ static int script_token_match(const Mode *sw, rofi_int_matcher **tokens,
}
}
}
if (rmpd->do_markup) {
g_free(esc);
}
return match;
}
return FALSE;
}
static char *script_get_message(const Mode *sw) {
ScriptModePrivateData *pd = sw->private_data;