From 0def3f8b2d3e073c67e70a5698d4b56ecd276464 Mon Sep 17 00:00:00 2001 From: antelle Date: Sat, 13 Mar 2021 10:11:32 +0100 Subject: [PATCH] fix #1745: deleting selected text in auto-type selector --- .../views/auto-type/auto-type-select-view.js | 16 ++++++++++++---- release-notes.md | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/scripts/views/auto-type/auto-type-select-view.js b/app/scripts/views/auto-type/auto-type-select-view.js index fff596b4..80a9e0dd 100644 --- a/app/scripts/views/auto-type/auto-type-select-view.js +++ b/app/scripts/views/auto-type/auto-type-select-view.js @@ -177,10 +177,18 @@ class AutoTypeSelectView extends View { backSpacePressed() { if (this.model.filter.text) { - this.model.filter.text = this.model.filter.text.substr( - 0, - this.model.filter.text.length - 1 - ); + const input = this.el.querySelector('.at-select__header-filter-input'); + if (input.selectionStart < input.selectionEnd) { + this.model.filter.text = + this.model.filter.text.substr(0, input.selectionStart) + + this.model.filter.text.substr(input.selectionEnd); + input.selectionStart = input.selectionEnd = 0; + } else { + this.model.filter.text = this.model.filter.text.substr( + 0, + this.model.filter.text.length - 1 + ); + } this.render(); } } diff --git a/release-notes.md b/release-notes.md index 35952f58..034709ab 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,6 +2,7 @@ Release notes ------------- ##### v1.17.2 (TBD) `-` fixed crashes in the USB module on Windows +`-` fix #1745: deleting selected text in auto-type selector ##### v1.17.1 (2021-03-10) `-` fix #1735: issue with auto-typing some characters on Windows