Implement ctrl+c bash hotkey to clear current input

This commit is contained in:
James Villegas 2022-07-03 11:49:45 +08:00
parent 6f017bf4f6
commit 9efb209ea3

@ -128,6 +128,9 @@ export function TerminalInput({ terminal, router, player }: IProps): React.React
case "clearbefore": // Deletes everything before cursor case "clearbefore": // Deletes everything before cursor
saveValue(inputText.substr(start), () => moveTextCursor("home")); saveValue(inputText.substr(start), () => moveTextCursor("home"));
break; break;
case "clearall": // Deletes everything in the input
saveValue("");
break;
} }
} }
@ -318,6 +321,11 @@ export function TerminalInput({ terminal, router, player }: IProps): React.React
// Extra Bash Emulation Hotkeys, must be enabled through options // Extra Bash Emulation Hotkeys, must be enabled through options
if (Settings.EnableBashHotkeys) { if (Settings.EnableBashHotkeys) {
if (event.code === KEYCODE.C && event.ctrlKey) {
event.preventDefault();
modifyInput("clearall");
}
if (event.code === KEYCODE.A && event.ctrlKey) { if (event.code === KEYCODE.A && event.ctrlKey) {
event.preventDefault(); event.preventDefault();
moveTextCursor("home"); moveTextCursor("home");