Allow to disable hint matching base on element text #581.
authorDaniel Carl <danielcarl@gmx.de>
Mon, 18 Nov 2019 22:20:00 +0000 (23:20 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Mon, 18 Nov 2019 22:20:00 +0000 (23:20 +0100)
doc/vimb.1
src/hints.c
src/setting.c

index 5c97e97..27e6fdf 100644 (file)
@@ -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.
index 86c9135..41917ca 100644 (file)
@@ -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)
index c16509b..fbdd680 100644 (file)
@@ -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");