Resolves #1194 again -- do alt and backspace

This commit is contained in:
Peter Cottle 2024-11-12 09:28:58 -05:00
parent 26327ec202
commit fe7c6563a9

View file

@ -109,8 +109,14 @@ var CommandPromptView = Backbone.View.extend({
el.selectionStart = el.selectionEnd = 0; el.selectionStart = el.selectionEnd = 0;
} }
// Handle Ctrl+Backspace to delete last word // handle control + W to delete up to previous word
if ((e.keyCode === 8 || e.keyCode === 87) && e.ctrlKey && e.type === 'keydown') { 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(); e.preventDefault();
const cursorPos = el.selectionStart; const cursorPos = el.selectionStart;
const textBeforeCursor = el.value.substring(0, cursorPos); const textBeforeCursor = el.value.substring(0, cursorPos);