{"complete", command_complete, {0}, VP_MODE_COMMAND | VP_MODE_COMPLETE},
{"complete-back", command_complete, {1}, VP_MODE_COMMAND | VP_MODE_COMPLETE},
{"inspect", command_inspect, {0}, VP_MODE_NORMAL},
- {"hint-link", command_hints, {HINTS_TYPE_LINK, ". "}, VP_MODE_HINTING},
- {"hint-link-new", command_hints, {HINTS_TYPE_LINK | HINTS_TARGET_BLANK, ", "}, VP_MODE_HINTING},
+ {"hint-link", command_hints, {HINTS_TYPE_LINK, "."}, VP_MODE_HINTING},
+ {"hint-link-new", command_hints, {HINTS_TYPE_LINK | HINTS_TARGET_BLANK, ","}, VP_MODE_HINTING},
{"hint-input-open", command_hints, {HINTS_TYPE_LINK | HINTS_PROCESS | HINTS_PROCESS_INPUT, ";o"}, VP_MODE_HINTING},
{"hint-input-tabopen", command_hints, {HINTS_TYPE_LINK | HINTS_TARGET_BLANK | HINTS_PROCESS | HINTS_PROCESS_INPUT, ";t"}, VP_MODE_HINTING},
{"hint-focus-next", command_hints_focus, {0}, VP_MODE_HINTING},
gboolean command_hints(const Arg* arg)
{
command_write_input(arg->s);
- hints_create(NULL, arg->i);
+ hints_create(NULL, arg->i, (arg->s ? strlen(arg->s) : 0));
return TRUE;
}
{
Hints* hints = &vp.hints;
- hints->list = NULL;
- hints->focusNum = 0;
- hints->num = 0;
+ hints->list = NULL;
+ hints->focusNum = 0;
+ hints->num = 0;
+ hints->prefixLength = 0;
}
void hints_clear(void)
hints_observe_input(FALSE);
}
-void hints_create(const gchar* input, guint mode)
+void hints_create(const gchar* input, guint mode, const guint prefixLength)
{
Hints* hints = &vp.hints;
Document* doc;
Window* win;
- hints->mode = mode;
hints_clear();
+ hints->mode = mode;
+
+ /* don't overwrite if zero */
+ if (prefixLength) {
+ hints->prefixLength = prefixLength;
+ }
doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(vp.gui.webview));
if (!doc) {
if (num == 0) {
/* recreate the hints */
- hints_create(NULL, hints->mode);
+ hints_create(NULL, hints->mode, 0);
return;
}
{
const gchar* text = GET_TEXT();
- /* skip hinting prefixes like '. ', ', ', ';y' ... */
- hints_create(text + 2, vp.hints.mode);
+ /* skip hinting prefixes like '.', ',', ';y' ... */
+ hints_create(text + vp.hints.prefixLength, vp.hints.mode, 0);
return TRUE;
}