Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 868e16c

Browse files
authored
Merge pull request #576 from matrix-org/kegan/cutting-doesnt-clear-tab-complete
Make cut operations update the tab complete list
2 parents 03bd4b1 + 5d03543 commit 868e16c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/TabComplete.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,20 @@ class TabComplete {
227227

228228
// pressing any key at all (except tab) restarts the automatic tab-complete timer
229229
if (this.opts.autoEnterTabComplete) {
230+
const cachedText = ev.target.value;
230231
clearTimeout(this.enterTabCompleteTimerId);
231232
this.enterTabCompleteTimerId = setTimeout(() => {
233+
if (this.completing) {
234+
// If you highlight text and CTRL+X it, tab-completing will not be reset.
235+
// This check makes sure that if something like a cut operation has been
236+
// done, that we correctly refresh the tab-complete list. Normal backspace
237+
// operations get caught by the stopTabCompleting() section above, but
238+
// because the CTRL key is held, this does not execute for CTRL+X.
239+
if (cachedText !== this.textArea.value) {
240+
this.stopTabCompleting();
241+
}
242+
}
243+
232244
if (!this.completing) {
233245
this.handleTabPress(true, false);
234246
}

0 commit comments

Comments
 (0)