Jump to line after the stored scroll position has been restored (#12324)

GitOrigin-RevId: 82265c6b0cab1ed3a34343efc5d47648e72dc41e
This commit is contained in:
Alf Eaton 2023-03-24 12:07:23 +00:00 committed by Copybot
parent 4ccf67203b
commit 9c78422efa

View file

@ -281,14 +281,19 @@ export default EditorManager = (function () {
// allow Ace to display document before moving, delay until next tick
// added delay to make this happen later that gotoStoredPosition in
// CursorPositionManager
return setTimeout(() => this.jumpToLine(options), 0)
} else if (options.gotoOffset != null) {
return setTimeout(() => {
return this.$scope.$broadcast(
'editor:gotoOffset',
options.gotoOffset
setTimeout(() => this.jumpToLine(options))
// when opening a doc in CM6, jump to the line again after a stored scroll position has been restored
if (isNewDoc) {
window.addEventListener(
'editor:scroll-position-restored',
() => this.jumpToLine(options),
{ once: true }
)
}, 0)
}
} else if (options.gotoOffset != null) {
setTimeout(() => {
this.$scope.$broadcast('editor:gotoOffset', options.gotoOffset)
})
}
}