gboolean command_hints(const Arg* arg)
{
command_write_input(arg->s);
+ /* mode will be set in hints_create - so we don't neet to do it here */
hints_create(NULL, arg->i, (arg->s ? strlen(arg->s) : 0));
- vb_set_mode(VB_MODE_HINTING, FALSE);
-
return TRUE;
}
{
hints_focus_next(arg->i ? TRUE : FALSE);
- vb_set_mode(VB_MODE_HINTING, FALSE);
-
return TRUE;
}
{
char* js = NULL;
if (CLEAN_MODE(vb.state.mode) != VB_MODE_HINTING) {
+ vb_set_mode(VB_MODE_HINTING, FALSE);
+
Style* style = &vb.style;
vb.hints.prefixLength = prefixLength;
vb.hints.mode = mode;
style->hint_style,
MAXIMUM_HINTS
);
- hints_run_script(js);
- g_free(js);
hints_observe_input(TRUE);
+
+ hints_run_script(js);
+ g_free(js);
}
vb.gui.webview, "hovering-over-link", NULL, *(value + 5) == '\0' ? NULL : (value + 5)
);
} else if (!strncmp(value, "DONE:", 5)) {
- hints_observe_input(FALSE);
vb_set_mode(VB_MODE_NORMAL, TRUE);
} else if (!strncmp(value, "INSERT:", 7)) {
- hints_observe_input(FALSE);
vb_set_mode(VB_MODE_INSERT, FALSE);
} else if (!strncmp(value, "DATA:", 5)) {
- hints_observe_input(FALSE);
Arg a = {0};
char* v = (value + 5);
if (mode & HINTS_PROCESS_INPUT) {
static void hints_fire()
{
- hints_observe_input(FALSE);
char* js = g_strdup_printf("%s.fire();", HINT_VAR);
hints_run_script(js);
g_free(js);
g_signal_handler_disconnect(G_OBJECT(vb.gui.inputbox), vb.hints.keypress_handler);
vb.hints.change_handler = vb.hints.keypress_handler = 0;
-
- /* clear the input box */
- vb_echo_force(VB_MSG_NORMAL, FALSE, "");
}
}
) {
completion_clean();
}
- int clean_mode = CLEAN_MODE(vb.state.mode);
+ int current_mode = CLEAN_MODE(vb.state.mode);
switch (CLEAN_MODE(mode)) {
case VB_MODE_NORMAL:
/* do this only if the mode is really switched */
- if (clean_mode != VB_MODE_NORMAL) {
+ if (current_mode != VB_MODE_NORMAL) {
history_rewind();
}
- if (clean_mode == VB_MODE_HINTING) {
+ if (current_mode == VB_MODE_HINTING) {
/* if previous mode was hinting clear the hints */
hints_clear();
- } else if (clean_mode == VB_MODE_INSERT) {
+ } else if (current_mode == VB_MODE_INSERT) {
/* clean the input if current mode is insert to remove -- INPUT -- */
clean = TRUE;
- } else if (clean_mode == VB_MODE_SEARCH) {
+ } else if (current_mode == VB_MODE_SEARCH) {
/* cleaup previous search */
command_search(&((Arg){VB_SEARCH_OFF}));
}