TERMINAL: Allow new lines in terminal when empty (#605)

This commit is contained in:
rqzcho 2023-06-13 21:04:21 +03:00 committed by GitHub
parent c7d05cae58
commit 2537ded3c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -194,12 +194,14 @@ export function TerminalInput(): React.ReactElement {
async function onKeyDown(event: React.KeyboardEvent<HTMLInputElement>): Promise<void> {
const ref = terminalInput.current;
// Run command.
if (event.key === KEY.ENTER && value !== "") {
// Run command or insert newline
if (event.key === KEY.ENTER) {
event.preventDefault();
Terminal.print(`[${Player.getCurrentServer().hostname} /${Terminal.cwd()}]> ${value}`);
if (value) {
Terminal.executeCommands(value);
saveValue("");
}
return;
}