mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-27 13:40:25 +00:00
clean up onDidChangeActiveTextEditor
Also fixes potential bug if line === 0
This commit is contained in:
@@ -78,11 +78,10 @@ export class MarkdownPreviewManager extends Disposable implements vscode.Webview
|
||||
this._register(vscode.window.registerCustomEditorProvider(this.customEditorViewType, this));
|
||||
|
||||
this._register(vscode.window.onDidChangeActiveTextEditor(textEditor => {
|
||||
|
||||
// When at a markdown file, apply existing scroll settings
|
||||
if (textEditor && textEditor.document && isMarkdownFile(textEditor.document)) {
|
||||
if (textEditor?.document && isMarkdownFile(textEditor.document)) {
|
||||
const line = this._topmostLineMonitor.getPreviousStaticEditorLineByUri(textEditor.document.uri);
|
||||
if (line) {
|
||||
if (typeof line === 'number') {
|
||||
scrollEditorToLine(line, textEditor);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user