Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { Disposable, DisposableStore, toDisposable } from '../../../../base/common/lifecycle.js';
import { IDisposable, Disposable, DisposableStore, toDisposable } from '../../../../base/common/lifecycle.js';
import { IActiveCodeEditor, ICodeEditor, MouseTargetType } from '../../../browser/editorBrowser.js';
import { IEditorContribution, ScrollType } from '../../../common/editorCommon.js';
import { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';
Expand Down Expand Up @@ -75,6 +75,7 @@ export class StickyScrollController extends Disposable implements IEditorContrib
private _showEndForLine: number | undefined;
private _minRebuildFromLine: number | undefined;
private _mouseTarget: EventTarget | null = null;
private _cursorPositionListener: IDisposable | undefined;

private readonly _onDidChangeStickyScrollHeight = this._register(new Emitter<{ height: number }>());
public readonly onDidChangeStickyScrollHeight = this._onDidChangeStickyScrollHeight.event;
Expand Down Expand Up @@ -475,10 +476,16 @@ export class StickyScrollController extends Disposable implements IEditorContrib

const lineNumberOption = this._editor.getOption(EditorOption.lineNumbers);
if (lineNumberOption.renderType === RenderLineNumbersType.Relative) {
this._sessionStore.add(this._editor.onDidChangeCursorPosition(() => {
this._showEndForLine = undefined;
this._renderStickyScroll(0);
}));
if (!this._cursorPositionListener) {
this._cursorPositionListener = this._editor.onDidChangeCursorPosition(() => {
this._showEndForLine = undefined;
this._renderStickyScroll(0);
});
this._sessionStore.add(this._cursorPositionListener);
}
} else if (this._cursorPositionListener) {
this._sessionStore.delete(this._cursorPositionListener);
this._cursorPositionListener = undefined;
}
}

Expand Down
Loading