Fixes #46208: Recover selection from markers when the undo/redo stack lacks selection information

This commit is contained in:
Alex Dima
2018-03-27 17:54:31 +02:00
parent 4f4dc86a12
commit 118e1445ea
4 changed files with 65 additions and 8 deletions

View File

@@ -50,7 +50,7 @@ class TrimWhitespaceParticipant implements ISaveParticipantParticipant {
}
private doTrimTrailingWhitespace(model: ITextModel, isAutoSaved: boolean): void {
let prevSelection: Selection[] = [new Selection(1, 1, 1, 1)];
let prevSelection: Selection[] = [];
const cursors: Position[] = [];
let editor = findEditor(model, this.codeEditorService);
@@ -114,7 +114,7 @@ export class FinalNewLineParticipant implements ISaveParticipantParticipant {
return;
}
let prevSelection: Selection[] = [new Selection(1, 1, 1, 1)];
let prevSelection: Selection[] = [];
const editor = findEditor(model, this.codeEditorService);
if (editor) {
prevSelection = editor.getSelections();
@@ -151,7 +151,7 @@ export class TrimFinalNewLinesParticipant implements ISaveParticipantParticipant
return;
}
let prevSelection: Selection[] = [new Selection(1, 1, 1, 1)];
let prevSelection: Selection[] = [];
const editor = findEditor(model, this.codeEditorService);
if (editor) {
prevSelection = editor.getSelections();