mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 05:05:47 +01:00
TERMINAL: Allow new lines in terminal when empty (#605)
This commit is contained in:
parent
c7d05cae58
commit
2537ded3c2
@ -194,12 +194,14 @@ export function TerminalInput(): React.ReactElement {
|
|||||||
async function onKeyDown(event: React.KeyboardEvent<HTMLInputElement>): Promise<void> {
|
async function onKeyDown(event: React.KeyboardEvent<HTMLInputElement>): Promise<void> {
|
||||||
const ref = terminalInput.current;
|
const ref = terminalInput.current;
|
||||||
|
|
||||||
// Run command.
|
// Run command or insert newline
|
||||||
if (event.key === KEY.ENTER && value !== "") {
|
if (event.key === KEY.ENTER) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
Terminal.print(`[${Player.getCurrentServer().hostname} /${Terminal.cwd()}]> ${value}`);
|
Terminal.print(`[${Player.getCurrentServer().hostname} /${Terminal.cwd()}]> ${value}`);
|
||||||
Terminal.executeCommands(value);
|
if (value) {
|
||||||
saveValue("");
|
Terminal.executeCommands(value);
|
||||||
|
saveValue("");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user