From 75c7e833240580847ebd4e415ddac94bdc63e379 Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Mon, 20 Jun 2022 22:46:55 +0200 Subject: [PATCH] No empty command execution --- components/REPL/REPLInput.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/REPL/REPLInput.tsx b/components/REPL/REPLInput.tsx index df59dfa..033a32e 100644 --- a/components/REPL/REPLInput.tsx +++ b/components/REPL/REPLInput.tsx @@ -83,6 +83,10 @@ const REPLInput: NextPage = ({historyCallback, historyClear, in case e.key === "Enter": { e.preventDefault(); 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)); clearInput(input); setInCmdHistory(-1);