diff --git a/src/vs/workbench/services/history/electron-browser/history.ts b/src/vs/workbench/services/history/electron-browser/history.ts index 307fbf408d9d9f3d5ca744aa1957708b879f49d8..2151ec22ffae70eb45d86588c837dfb444c755c5 100644 --- a/src/vs/workbench/services/history/electron-browser/history.ts +++ b/src/vs/workbench/services/history/electron-browser/history.ts @@ -210,15 +210,15 @@ export class HistoryService extends Disposable implements IHistoryService { // 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 = { input: activeEditor }; - this.lastEditLocation = { - input: activeEditor, - selection: { + const position = activeTextEditorWidget.getPosition(); + if (position) { + this.lastEditLocation.selection = { startLineNumber: position.lineNumber, startColumn: position.column - } - }; + }; + } }))); } }