reveal active line into view only when it is not triggered by view restore.
This commit is contained in:
parent
10f5103a12
commit
c2c74e602d
|
@ -130,7 +130,12 @@ export class CodeCell extends Disposable {
|
|||
}
|
||||
}));
|
||||
|
||||
this._register(templateData.editor!.onDidChangeCursorSelection(() => {
|
||||
this._register(templateData.editor!.onDidChangeCursorSelection((e) => {
|
||||
if (e.source === 'restoreState') {
|
||||
// do not reveal the cell into view if this selection change was caused by restoring editors...
|
||||
return;
|
||||
}
|
||||
|
||||
const primarySelection = templateData.editor!.getSelection();
|
||||
|
||||
if (primarySelection) {
|
||||
|
|
|
@ -180,6 +180,19 @@ export class StatefullMarkdownCell extends Disposable {
|
|||
}
|
||||
}));
|
||||
|
||||
this.localDisposables.add(this.editor!.onDidChangeCursorSelection((e) => {
|
||||
if (e.source === 'restoreState') {
|
||||
// do not reveal the cell into view if this selection change was caused by restoring editors...
|
||||
return;
|
||||
}
|
||||
|
||||
const primarySelection = this.editor!.getSelection();
|
||||
|
||||
if (primarySelection) {
|
||||
this.notebookEditor.revealLineInView(this.viewCell, primarySelection!.positionLineNumber);
|
||||
}
|
||||
}));
|
||||
|
||||
let cellWidthResizeObserver = getResizesObserver(this.templateData.editingContainer!, dimension, () => {
|
||||
let newWidth = cellWidthResizeObserver.getWidth();
|
||||
let realContentHeight = this.editor!.getContentHeight();
|
||||
|
|
Loading…
Reference in a new issue