mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 19:44:25 +01:00
Fixes #39750
Doesn't edit the model unless an edit is required, which means the undo stack is updated properly. Behaviour should be similar to trimTrailingWhitespace
This commit is contained in:
@@ -157,7 +157,11 @@ export class TrimFinalNewLinesParticipant implements ISaveParticipant {
|
||||
currentLine = model.getLineContent(currentLineNumber);
|
||||
currentLineIsEmptyOrWhitespace = strings.lastNonWhitespaceIndex(currentLine) === -1;
|
||||
}
|
||||
model.pushEditOperations(prevSelection, [EditOperation.delete(new Range(currentLineNumber + 1, 1, lineCount + 1, 1))], edits => prevSelection);
|
||||
|
||||
const deletionRange = new Range(currentLineNumber + 1, 1, lineCount + 1, 1);
|
||||
if (!deletionRange.isEmpty()) {
|
||||
model.pushEditOperations(prevSelection, [EditOperation.delete(deletionRange)], edits => prevSelection);
|
||||
}
|
||||
|
||||
if (editor) {
|
||||
editor.setSelections(prevSelection);
|
||||
|
||||
Reference in New Issue
Block a user