From 689981fbd359a8c3b299292e5a032ab06d9cc6c7 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Sat, 6 Aug 2011 04:35:48 +0200 Subject: [PATCH] Allow to change focused hint by tab and shift-tab. --- hinting.js | 9 +++++++-- main.c | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/hinting.js b/hinting.js index 0cc9ce0..b60aa63 100644 --- a/hinting.js +++ b/hinting.js @@ -11,7 +11,7 @@ function Hints() { var focusedHint; var colors; var backgrounds; - var currentFocusNum = 1; + var currentFocusNum = 1; /* holds the number of the active hint */ this.createHints = function(inputText) { @@ -49,7 +49,7 @@ function Hints() { hintSpan.style.background = "red"; hintSpan.style.color = "#fff"; hintSpan.style.font = "bold 10px monospace"; - hintSpan.style.zIndex = "1000000"; + hintSpan.style.zIndex = "10000000"; /* due to the different XPath result type, we will need two counter variables */ this.hintCount = 0; @@ -121,6 +121,11 @@ function Hints() { this.focusHint(++this.currentFocusNum); }; + this.focusPreviousHint = function() + { + this.focusHint(--this.currentFocusNum); + }; + this.updateHints = function(n) { if (this.hintCount - 1 < n * 10 && typeof(this.hintElements[n - 1]) != "undefined") { diff --git a/main.c b/main.c index 66168ae..d094b1f 100644 --- a/main.c +++ b/main.c @@ -487,6 +487,21 @@ inputbox_keypress_cb(GtkEntry *entry, GdkEventKey *event) { Arg a; int numval; + if (mode == ModeHints) { + if (event->keyval == GDK_Tab) { + a.i = Silent; + a.s = g_strdup_printf("hints.focusNextHint();"); + script(&a); + update_state(); + return TRUE; + } else if (event->keyval == GDK_ISO_Left_Tab) { + a.i = Silent; + a.s = g_strdup_printf("hints.focusPreviousHint();"); + script(&a); + update_state(); + return TRUE; + } + } switch (event->keyval) { case GDK_bracketleft: case GDK_Escape: -- 2.11.4.GIT