Add keybinding meta-backspace to delete to beginning of line

pull/5738/head
Peter VandeHaar 2021-10-20 16:30:40 -04:00 committed by John McLear
parent 7ece72503a
commit ef918790ca
1 changed files with 5 additions and 1 deletions

View File

@ -2433,7 +2433,11 @@ function Ace2Inner(editorInfo, cssManagers) {
const lineEntry = rep.lines.atIndex(lineNum); const lineEntry = rep.lines.atIndex(lineNum);
const lineText = lineEntry.text; const lineText = lineEntry.text;
const lineMarker = lineEntry.lineMarker; const lineMarker = lineEntry.lineMarker;
if (/^ +$/.exec(lineText.substring(lineMarker, col))) { if (evt.metaKey && col > lineMarker) {
// cmd-backspace deletes to start of line (if not already at start)
performDocumentReplaceRange([lineNum, lineMarker], [lineNum, col], '');
handled = true;
} else if (/^ +$/.exec(lineText.substring(lineMarker, col))) {
const col2 = col - lineMarker; const col2 = col - lineMarker;
const tabSize = THE_TAB.length; const tabSize = THE_TAB.length;
const toDelete = ((col2 - 1) % tabSize) + 1; const toDelete = ((col2 - 1) % tabSize) + 1;