From 1871390096235cd71138c075f5813bbaf9497039 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 26 Sep 2018 10:32:36 +0200 Subject: [PATCH] fix #59370 --- .../workbench/services/history/electron-browser/history.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/services/history/electron-browser/history.ts b/src/vs/workbench/services/history/electron-browser/history.ts index 0c81117700b..307fbf408d9 100644 --- a/src/vs/workbench/services/history/electron-browser/history.ts +++ b/src/vs/workbench/services/history/electron-browser/history.ts @@ -207,7 +207,9 @@ export class HistoryService extends Disposable implements IHistoryService { }))); // Track the last edit location by tracking model content change events - this.activeEditorListeners.push(activeTextEditorWidget.onDidChangeModelContent(() => { + // Use a debouncer to make sure to capture the correct cursor position + // after the model content has changed. + this.activeEditorListeners.push(debounceEvent(activeTextEditorWidget.onDidChangeModelContent, (last, event) => event, 0)((event => { const position = activeTextEditorWidget.getPosition(); this.lastEditLocation = { @@ -217,7 +219,7 @@ export class HistoryService extends Disposable implements IHistoryService { startColumn: position.column } }; - })); + }))); } } -- GitLab