mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 03:23:48 +01:00
Focus editor when opening or changing tabs
This commit is contained in:
parent
08a4a1649f
commit
e60996b86c
@ -291,6 +291,8 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
editorRef.current.revealLineInCenter(currentScript.lastPosition.lineNumber);
|
editorRef.current.revealLineInCenter(currentScript.lastPosition.lineNumber);
|
||||||
updateRAM(currentScript.code);
|
updateRAM(currentScript.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
editorRef.current.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function infLoop(newCode: string): void {
|
function infLoop(newCode: string): void {
|
||||||
@ -505,6 +507,7 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
editorRef.current.setPosition(openScripts[index].lastPosition);
|
editorRef.current.setPosition(openScripts[index].lastPosition);
|
||||||
editorRef.current.revealLineInCenter(openScripts[index].lastPosition.lineNumber);
|
editorRef.current.revealLineInCenter(openScripts[index].lastPosition.lineNumber);
|
||||||
updateRAM(openScripts[index].code);
|
updateRAM(openScripts[index].code);
|
||||||
|
editorRef.current.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,6 +553,7 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
editorRef.current.setModel(openScripts[index + indexOffset].model);
|
editorRef.current.setModel(openScripts[index + indexOffset].model);
|
||||||
editorRef.current.setPosition(openScripts[index + indexOffset].lastPosition);
|
editorRef.current.setPosition(openScripts[index + indexOffset].lastPosition);
|
||||||
editorRef.current.revealLineInCenter(openScripts[index + indexOffset].lastPosition.lineNumber)
|
editorRef.current.revealLineInCenter(openScripts[index + indexOffset].lastPosition.lineNumber)
|
||||||
|
editorRef.current.focus();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No more scripts are open
|
// No more scripts are open
|
||||||
|
Loading…
Reference in New Issue
Block a user