mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 14:28:36 +02:00
BUGFIX: Cursor position in editor is moved undesirably in edge cases (#1952)
This commit is contained in:
@@ -111,7 +111,14 @@ function Root(props: IProps): React.ReactElement {
|
||||
}
|
||||
if (needToReloadModel) {
|
||||
const currentModel = editorRef.current.getModel();
|
||||
// Save the current cursor position. The position resets when the model is changed.
|
||||
const currentPosition = editorRef.current.getPosition();
|
||||
// Reload the model.
|
||||
currentModel?.setValue(currentModel.getValue());
|
||||
// Restore the saved position.
|
||||
if (currentPosition) {
|
||||
editorRef.current.setPosition(currentPosition);
|
||||
}
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user