From a8803b454362391e26a4450a3d8bb4db5b9c6583 Mon Sep 17 00:00:00 2001 From: Pradeep Murugesan Date: Thu, 5 Apr 2018 15:10:59 +0200 Subject: [PATCH] #47041 fixed the scrolling of the editor and cursor after the revert from inline diff viewer --- extensions/git/src/commands.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index e37383c4932..0d990d07102 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -766,10 +766,14 @@ export class CommandCenter { return; } + const selectionsBeforeRevert = textEditor.selections; + const visibleRangesBeforeRevert = textEditor.visibleRanges; const result = applyLineChanges(originalDocument, modifiedDocument, changes); const edit = new WorkspaceEdit(); edit.replace(modifiedUri, new Range(new Position(0, 0), modifiedDocument.lineAt(modifiedDocument.lineCount - 1).range.end), result); workspace.applyEdit(edit); + textEditor.selections = selectionsBeforeRevert; + textEditor.revealRange(visibleRangesBeforeRevert[0]); await modifiedDocument.save(); }