From e90312806954047a61149fe077f57e19cfe87f6a Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Sun, 26 Dec 2021 16:21:08 +0100 Subject: [PATCH] Clear input (ctrl u/c) --- components/REPL/REPLInput.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/REPL/REPLInput.tsx b/components/REPL/REPLInput.tsx index a1f02a6..afbf7e9 100644 --- a/components/REPL/REPLInput.tsx +++ b/components/REPL/REPLInput.tsx @@ -53,6 +53,7 @@ const REPLInput: NextPage = ({historyCallback, historyClear, in if(typed.current) typed.current.innerHTML = currentCmd[justTabbed % currentCmd.length]; if(completion.current) completion.current.innerHTML = ""; setJustTabbed(justTabbed + 1); + return false; } else setJustTabbed(0); if (e.key === "Enter") { @@ -66,6 +67,7 @@ const REPLInput: NextPage = ({historyCallback, historyClear, in const result = executeCommand(command); clearInput(input); historyCallback(result); + return false; } if (e.key === "d" && e.ctrlKey) { @@ -73,15 +75,22 @@ const REPLInput: NextPage = ({historyCallback, historyClear, in const result = executeCommand("exit"); clearInput(input); historyCallback(result); + return false; } if (e.key === "l" && e.ctrlKey) { e.preventDefault(); clearInput(input); historyClear(); + return false; + } + + if ((e.key === "c" || e.key === "u") && e.ctrlKey) { + e.preventDefault(); + clearInput(input); + return false; } - return false; }; return