.PD
.RE
.TP
+.B hint-timeout (int)
+Timeout before automatically following a non-unique numerical hint. To disable
+auto fire of hints, set this value to 0.
+.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.
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkkeysyms-compat.h>
#include "hints.h"
+#include "main.h"
#include "ascii.h"
#include "dom.h"
#include "command.h"
* have to change to open windows via hinting */
gboolean allow_open_win;
#endif
+ guint timeout_id;
} hints;
extern VbCore vb;
static gboolean call_hints_function(const char *func, int count, JSValueRef params[]);
+static void fire_timeout(gboolean on);
+static gboolean fire_cb(gpointer data);
void hints_init(WebKitWebFrame *frame)
return RESULT_COMPLETE;
} else if (key == CTRL('H')) {
+ fire_timeout(false);
arguments[0] = JSValueMakeNull(hints.ctx);
if (call_hints_function("update", 1, arguments)) {
return RESULT_COMPLETE;
}
} else if (VB_IS_DIGIT(key)) {
+ fire_timeout(true);
+
arguments[0] = JSValueMakeNumber(hints.ctx, key - '0');
if (call_hints_function("update", 1, arguments)) {
return RESULT_COMPLETE;
}
} else if (key == KEY_TAB) {
+ fire_timeout(false);
hints_focus_next(false);
return RESULT_COMPLETE;
} else if (key == KEY_SHIFT_TAB) {
+ fire_timeout(false);
hints_focus_next(true);
return RESULT_COMPLETE;
}
+ fire_timeout(false);
return RESULT_ERROR;
}
/* following return values mark fired hints */
if (!strncmp(value, "DONE:", 5)) {
+ fire_timeout(false);
if (!hints.gmode) {
mode_enter('n');
}
} else if (!strncmp(value, "INSERT:", 7)) {
+ fire_timeout(false);
mode_enter('i');
if (hints.mode == 'e') {
input_open_editor();
}
} else if (!strncmp(value, "DATA:", 5)) {
+ fire_timeout(false);
/* switch first to normal mode - else we would clear the inputbox
* on switching mode also if we want to show yanked data */
if (!hints.gmode) {
g_free(value);
return true;
}
+
+static void fire_timeout(gboolean on)
+{
+ int millis;
+ /* remove possible timeout function */
+ if (hints.timeout_id) {
+ g_source_remove(hints.timeout_id);
+ hints.timeout_id = 0;
+ }
+
+ if (on) {
+ millis = GET_INT("hint-timeout");
+ if (millis) {
+ hints.timeout_id = g_timeout_add(millis, (GSourceFunc)fire_cb, NULL);
+ }
+ }
+}
+
+static gboolean fire_cb(gpointer data)
+{
+ hints_fire();
+
+ /* remove timeout id for the timeout that is removed by return value of
+ * false automatic */
+ hints.timeout_id = 0;
+ return false;
+}
setting_add("completion-bg-active", TYPE_COLOR, &"#777777", input_color, &vb.style.comp_bg[VB_COMP_ACTIVE]);
setting_add("ca-bundle", TYPE_CHAR, &"/etc/ssl/certs/ca-certificates.crt", ca_bundle, NULL);
setting_add("home-page", TYPE_CHAR, &SETTING_HOME_PAGE, NULL, NULL);
+ i = 1000;
+ setting_add("hint-timeout", TYPE_INTEGER, &i, NULL, NULL);
setting_add("download-path", TYPE_CHAR, &"", internal, &vb.config.download_dir);
i = 2000;
setting_add("history-max-items", TYPE_INTEGER, &i, internal, &vb.config.history_max);