mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-21 11:15:38 +02:00
Resolves #1194 again -- do alt and backspace
This commit is contained in:
parent
26327ec202
commit
fe7c6563a9
1 changed files with 8 additions and 2 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue