summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-03-08 12:15:47 +0200
committerAlon Levy <alon@pobox.com>2015-03-08 12:15:47 +0200
commit1586cf7423ba350ea3a3afaa0566afe4521904e9 (patch)
treec7c83bb7e07eb2b37382a6d2c09f05a09e249964 /src/client
parente4fa918727d6583152e5b91df8873b53079f3c33 (diff)
client: fix up/down being handled both by completer and by type selector when shift pressed
Diffstat (limited to 'src/client')
-rw-r--r--src/client/consts.js5
-rw-r--r--src/client/view/completer.js18
-rw-r--r--src/client/view/textanalyser_input.js4
3 files changed, 20 insertions, 7 deletions
diff --git a/src/client/consts.js b/src/client/consts.js
index ff693d08..411a79e6 100644
--- a/src/client/consts.js
+++ b/src/client/consts.js
@@ -18,5 +18,10 @@ define(function() {
INPUT_WHERE_TEXTANALYSIS: 'input_where_textanalysis',
description: description,
NEW_NODE_NAME: 'new node',
+
+ // Keycodes (should just use jquery)
+ VK_UP: 38,
+ VK_DOWN: 40,
+ VK_ESCAPE: 27,
};
});
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 () {