From 5d03543f8589f6648a1da49c4bb9c5b8aa28326e Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 30 Nov 2016 10:49:40 +0000 Subject: [PATCH] Make cut operations update the tab complete list --- src/TabComplete.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/TabComplete.js b/src/TabComplete.js index 65441c9381..a0380f36c4 100644 --- a/src/TabComplete.js +++ b/src/TabComplete.js @@ -227,8 +227,20 @@ class TabComplete { // pressing any key at all (except tab) restarts the automatic tab-complete timer if (this.opts.autoEnterTabComplete) { + const cachedText = ev.target.value; clearTimeout(this.enterTabCompleteTimerId); this.enterTabCompleteTimerId = setTimeout(() => { + if (this.completing) { + // If you highlight text and CTRL+X it, tab-completing will not be reset. + // This check makes sure that if something like a cut operation has been + // done, that we correctly refresh the tab-complete list. Normal backspace + // operations get caught by the stopTabCompleting() section above, but + // because the CTRL key is held, this does not execute for CTRL+X. + if (cachedText !== this.textArea.value) { + this.stopTabCompleting(); + } + } + if (!this.completing) { this.handleTabPress(true, false); }