From fe7c6563a9eb405ccb135849fb832ed8fdcfb581 Mon Sep 17 00:00:00 2001 From: Peter Cottle Date: Tue, 12 Nov 2024 09:28:58 -0500 Subject: [PATCH] Resolves #1194 again -- do alt and backspace --- src/js/views/commandViews.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/js/views/commandViews.js b/src/js/views/commandViews.js index ba5561f91..9599ce5cf 100644 --- a/src/js/views/commandViews.js +++ b/src/js/views/commandViews.js @@ -109,8 +109,14 @@ var CommandPromptView = Backbone.View.extend({ el.selectionStart = el.selectionEnd = 0; } - // Handle Ctrl+Backspace to delete last word - if ((e.keyCode === 8 || e.keyCode === 87) && e.ctrlKey && e.type === 'keydown') { + // handle control + W to delete up to previous word + const isDeleteWord = ( + e.keyCode === 87 && e.ctrlKey && e.type === 'keydown' + ) || ( + // handle alt + backspace to delete up to previous word + e.keyCode === 8 && e.altKey && e.type === 'keydown' + ); + if (isDeleteWord) { e.preventDefault(); const cursorPos = el.selectionStart; const textBeforeCursor = el.value.substring(0, cursorPos);