make Backspace delete the current selection correctly (#108)
This commit is contained in:
parent
7727e62655
commit
c4f6f80166
1 changed files with 18 additions and 14 deletions
|
@ -257,6 +257,9 @@ export class CodeEditor extends HTMLElement {
|
|||
this.pushHistory({ allowMerge: true });
|
||||
|
||||
let selection = this.getSelection();
|
||||
if (selection.start != selection.end) {
|
||||
this.replace(selection, "");
|
||||
} else {
|
||||
selection.collapse();
|
||||
|
||||
let start = getLineStart(this.code, selection.start);
|
||||
|
@ -270,8 +273,9 @@ export class CodeEditor extends HTMLElement {
|
|||
selection.cursor -= charactersToRemove;
|
||||
selection.clampCursor(this.code);
|
||||
this.replace(selection, "");
|
||||
selection.collapse();
|
||||
}
|
||||
|
||||
selection.collapse();
|
||||
this.setSelection(selection);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue