diff options
author | Daniel Carl <danielcarl@gmx.de> | 2014-11-21 23:17:40 +0100 |
---|---|---|
committer | Daniel Carl <danielcarl@gmx.de> | 2014-11-21 23:28:07 +0100 |
commit | 16af4dcc6dcb52f84f090a59640405705abde3a8 (patch) | |
tree | fde8a53ebbab466042177ffa97a9002956e1d7e1 /src/hints.c | |
parent | c17d57cf2610b55fc9836039de5ebe8b5d43b262 (diff) |
Added hints by letters.
The new setting 'hintkeys' holds the chars to use as hint label to fire the
hints. Default value is '0123456789', but it's now possible to use letters
too.
Diffstat (limited to 'src/hints.c')
-rw-r--r-- | src/hints.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/hints.c b/src/hints.c index 516f204..f5fd307 100644 --- a/src/hints.c +++ b/src/hints.c @@ -86,13 +86,6 @@ VbResult hints_keypress(int key) 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); @@ -103,6 +96,13 @@ VbResult hints_keypress(int key) hints_focus_next(true); return RESULT_COMPLETE; + } else { + /* try to handle the key by the javascript */ + arguments[0] = js_string_to_ref(hints.ctx, (char[]){key, '\0'}); + if (call_hints_function("update", 1, arguments)) { + fire_timeout(true); + return RESULT_COMPLETE; + } } fire_timeout(false); @@ -167,9 +167,10 @@ void hints_create(const char *input) JSValueRef arguments[] = { js_string_to_ref(hints.ctx, (char[]){hints.mode, '\0'}), JSValueMakeBoolean(hints.ctx, hints.gmode), - JSValueMakeNumber(hints.ctx, MAXIMUM_HINTS) + JSValueMakeNumber(hints.ctx, MAXIMUM_HINTS), + js_string_to_ref(hints.ctx, GET_CHAR("hintkeys")), }; - call_hints_function("init", 3, arguments); + call_hints_function("init", 4, arguments); /* if hinting is started there won't be any additional filter given and * we can go out of this function */ |