From b036813ded46a3b66644c451dc2a619389800edf Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 26 Apr 2012 13:58:54 -0700 Subject: IKNINJA-1534: don't show code hinting automatically, when word removed via backspaces Signed-off-by: Ananya Sen --- js/code-editor/codemirror-ninja-lib/ninja-simple-hint.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/code-editor/codemirror-ninja-lib/ninja-simple-hint.js b/js/code-editor/codemirror-ninja-lib/ninja-simple-hint.js index e2334a45..866e1a8b 100644 --- a/js/code-editor/codemirror-ninja-lib/ninja-simple-hint.js +++ b/js/code-editor/codemirror-ninja-lib/ninja-simple-hint.js @@ -2,6 +2,12 @@ CodeMirror.simpleHint = function(editor, getHints) { // We want a single cursor position. if (editor.somethingSelected()) return; + + // Ninja override: don't show code hinting if the token is empty + var tempToken = editor.getTokenAt(editor.getCursor()); + if(tempToken && ((tempToken.string === "") || !(/[\S]/gi.test(tempToken.string)))) return;//check that token has only spaces + + var result = getHints(editor); if (!result || !result.list.length) return; var completions = result.list; -- cgit v1.2.3