From: Daniel Carl Date: Mon, 18 Nov 2019 22:20:00 +0000 (+0100) Subject: Allow to disable hint matching base on element text #581. X-Git-Url: https://git.owens.tech/about.html/about.html/git?a=commitdiff_plain;h=51026d3bce72c290c0e5a7fcabe6e5711bc9850c;p=vimb.git Allow to disable hint matching base on element text #581. --- diff --git a/doc/vimb.1 b/doc/vimb.1 index 5c97e97..27e6fdf 100644 --- a/doc/vimb.1 +++ b/doc/vimb.1 @@ -1288,6 +1288,12 @@ To have upper case hint labels, it's possible to add following css to the .IP "span[vimbhint="label"] {text-transform: uppercase !important;}" .TP +.B hint-match-element (bool) +If this is set to 'true' typed chars that are not part of the set 'hint-keys' +are used to filter hinted DOM elements by their text value. +If 'hint-keys' are set to chars instead of numbers it might be useful to +disable matching of the elements by 'hint-match-element=false'. +.TP .B history-max-items (int) Maximum number of unique items stored in search-, command or URI history. If history-max-items is set to 0, the history file will not be changed. diff --git a/src/hints.c b/src/hints.c index 86c9135..41917ca 100644 --- a/src/hints.c +++ b/src/hints.c @@ -168,9 +168,11 @@ void hints_create(Client *c, const char *input) return; } - jsargs = g_strdup_printf("'%s'", *(input + hints.promptlen) ? input + hints.promptlen : ""); - call_hints_function(c, "filter", jsargs, FALSE); - g_free(jsargs); + if (GET_BOOL(c, "hint-match-element")) { + jsargs = g_strdup_printf("'%s'", *(input + hints.promptlen) ? input + hints.promptlen : ""); + call_hints_function(c, "filter", jsargs, FALSE); + g_free(jsargs); + } } void hints_focus_next(Client *c, const gboolean back) diff --git a/src/setting.c b/src/setting.c index c16509b..fbdd680 100644 --- a/src/setting.c +++ b/src/setting.c @@ -97,6 +97,7 @@ void setting_init(Client *c) setting_add(c, "hint-keys", TYPE_CHAR, &"0123456789", NULL, 0, NULL); setting_add(c, "hint-follow-last", TYPE_BOOLEAN, &on, NULL, 0, NULL); setting_add(c, "hint-keys-same-length", TYPE_BOOLEAN, &off, NULL, 0, NULL); + setting_add(c, "hint-match-element", TYPE_BOOLEAN, &on, NULL, 0, NULL); setting_add(c, "html5-database", TYPE_BOOLEAN, &on, webkit, 0, "enable-html5-database"); setting_add(c, "html5-local-storage", TYPE_BOOLEAN, &on, webkit, 0, "enable-html5-local-storage"); setting_add(c, "hyperlink-auditing", TYPE_BOOLEAN, &off, webkit, 0, "enable-hyperlink-auditing");