From 1f7204441314b551a2a6b35235fb665a4781db65 Mon Sep 17 00:00:00 2001 From: Yingjie He Date: Fri, 28 Mar 2025 09:08:26 -0700 Subject: [PATCH] feat: Enable Option + Enter to insert a new line (#1887) --- ui/desktop/src/components/Input.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/desktop/src/components/Input.tsx b/ui/desktop/src/components/Input.tsx index bce25323..4224735e 100644 --- a/ui/desktop/src/components/Input.tsx +++ b/ui/desktop/src/components/Input.tsx @@ -111,9 +111,13 @@ export default function Input({ } if (evt.key === 'Enter') { - // should not trigger submit on Enter if it's composing (IME input in progress) or shift is pressed + // should not trigger submit on Enter if it's composing (IME input in progress) or shift/alt(option) is pressed if (evt.shiftKey || isComposing) { - // Allow line break for Shift+Enter or during IME composition + // Allow line break for Shift+Enter, or during IME composition + return; + } + if (evt.altKey) { + setValue(value + '\n'); return; }