From b80015c69c39e2a9df8038a46f121156a233fd1e Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 23 Dec 2015 13:33:44 +0000 Subject: [PATCH] More comments; remove redundant if statement --- src/TabComplete.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/TabComplete.js b/src/TabComplete.js index b6c10af532..fb2571a8f8 100644 --- a/src/TabComplete.js +++ b/src/TabComplete.js @@ -140,17 +140,15 @@ class TabComplete { this.inPassiveMode = ev.passive; if (ev.keyCode !== KEY_TAB) { + // pressing any key (except shift, windows, cmd (OSX) and ctrl/alt combinations) + // aborts the current tab completion if (this.completing && ev.keyCode !== KEY_SHIFT && !ev.metaKey && !ev.ctrlKey && !ev.altKey && ev.keyCode !== KEY_WINDOWS) { // they're resuming typing; reset tab complete state vars. this.stopTabCompleting(); - - // fall through to auto-enter-tab-completing if set - if (!this.opts.autoEnterTabComplete) { - return; - } } + // pressing any key at all (except tab) restarts the automatic tab-complete timer if (this.opts.autoEnterTabComplete) { clearTimeout(this.enterTabCompleteTimerId); this.enterTabCompleteTimerId = setTimeout(() => { @@ -170,6 +168,8 @@ class TabComplete { return; } + // tab key has been pressed at this point + if (!this.textArea) { console.error("onKeyDown called before a