From 7bf74c6a5d07e5746a1299b61a3cac1bd08ec416 Mon Sep 17 00:00:00 2001 From: "ShengYan, Zhang" Date: Thu, 11 May 2023 16:08:34 +0800 Subject: [PATCH] fix: bug #1413 cmd/alt/ctrl should be checked for arrowUp events --- app/components/chat.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index d47673116..10f7c0025 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -230,7 +230,9 @@ export function PromptHints(props: { useEffect(() => { const onKeyDown = (e: KeyboardEvent) => { if (noPrompts) return; - + if (e.metaKey || e.altKey || e.ctrlKey) { + return; + } // arrow up / down to select prompt const changeIndex = (delta: number) => { e.stopPropagation(); @@ -491,7 +493,11 @@ export function Chat() { // check if should send message const onInputKeyDown = (e: React.KeyboardEvent) => { // if ArrowUp and no userInput, fill with last input - if (e.key === "ArrowUp" && userInput.length <= 0) { + if ( + e.key === "ArrowUp" && + userInput.length <= 0 && + !(e.metaKey || e.altKey || e.ctrlKey) + ) { setUserInput(localStorage.getItem(LAST_INPUT_KEY) ?? ""); e.preventDefault(); return;