No empty command execution
This commit is contained in:
parent
6d1d791163
commit
75c7e83324
@ -83,6 +83,10 @@ const REPLInput: NextPage<REPLInputParams> = ({historyCallback, historyClear, in
|
|||||||
case e.key === "Enter": {
|
case e.key === "Enter": {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const command = (e.target as HTMLInputElement).value.trim();
|
const command = (e.target as HTMLInputElement).value.trim();
|
||||||
|
if (command.length === 0) {
|
||||||
|
historyCallback(["$"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (cmdHistory.at(-1) !== command) setCmdHistory(cmdHistory.concat([command]).splice(0, 100));
|
if (cmdHistory.at(-1) !== command) setCmdHistory(cmdHistory.concat([command]).splice(0, 100));
|
||||||
clearInput(input);
|
clearInput(input);
|
||||||
setInCmdHistory(-1);
|
setInCmdHistory(-1);
|
||||||
|
Loading…
Reference in New Issue
Block a user