Skip to content

Commit

Permalink
Resolves #1194 again -- do alt and backspace
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Cottle committed Nov 12, 2024
1 parent 26327ec commit fe7c656
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/js/views/commandViews.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fe7c656

Please sign in to comment.