diff options
| author | Alon Levy <alon@pobox.com> | 2015-03-08 12:15:47 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-03-08 12:15:47 +0200 |
| commit | 1586cf7423ba350ea3a3afaa0566afe4521904e9 (patch) | |
| tree | c7c83bb7e07eb2b37382a6d2c09f05a09e249964 /src/client/view | |
| parent | e4fa918727d6583152e5b91df8873b53079f3c33 (diff) | |
client: fix up/down being handled both by completer and by type selector when shift pressed
Diffstat (limited to 'src/client/view')
| -rw-r--r-- | src/client/view/completer.js | 18 | ||||
| -rw-r--r-- | src/client/view/textanalyser_input.js | 4 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/client/view/completer.js b/src/client/view/completer.js index 19ec636b..f05c40a0 100644 --- a/src/client/view/completer.js +++ b/src/client/view/completer.js @@ -1,10 +1,15 @@ define( -['jquery', 'Bacon', 'util'], -function($, Bacon, util) { +['jquery', 'Bacon', 'util', 'consts'], +function($, Bacon, util, consts) { var value = util.value, selectionStart = util.selectionStart; +// constants +var VK_UP = consts.VK_UP, + VK_DOWN = consts.VK_DOWN, + VK_ESCAPE = consts.VK_ESCAPE; + function quoted__double(string) { // quote string using double quotes return '"' + string + '"'; } @@ -66,16 +71,19 @@ var completer = (function (input_element, dropdown, base_config) { input_element.keyup(function(e) { var ret = undefined; + if (e.shiftKey) { + return ret; + } switch (e.keyCode) { - case 38: //UP + case VK_UP: //UP prev_option(); ret = false; break; - case 40: //DOWN + case VK_DOWN: //DOWN next_option(); ret = false; break; - case 27: // Escape + case VK_ESCAPE: // Escape hide(); ret = false; break; diff --git a/src/client/view/textanalyser_input.js b/src/client/view/textanalyser_input.js index f6f7bc04..15b59776 100644 --- a/src/client/view/textanalyser_input.js +++ b/src/client/view/textanalyser_input.js @@ -6,8 +6,8 @@ var value = util.value; // Constants var nbsp = String.fromCharCode(160), - VK_UP = 38, - VK_DOWN = 40; + VK_UP = consts.VK_UP, + VK_DOWN = consts.VK_DOWN; function textanalyser_input(spec) { var selectionStart = function () { |
