From 3d3674d4dde23e8aa54367b5085d02020bc791b2 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Tue, 23 Jun 2026 23:21:09 +0300 Subject: [PATCH] fix: restore arrow-up message history navigation Lets ArrowUp recall previous messages when the cursor is at the start Keeps autocomplete guards for history navigation Restores prior chat input behavior --- packages/ui/src/components/chat/ChatInput.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/ui/src/components/chat/ChatInput.tsx b/packages/ui/src/components/chat/ChatInput.tsx index 2bed05ee..4163227b 100644 --- a/packages/ui/src/components/chat/ChatInput.tsx +++ b/packages/ui/src/components/chat/ChatInput.tsx @@ -2397,11 +2397,12 @@ const ChatInputComponent: React.FC = ({ onOpenSettings, scrollTo } // Handle ArrowUp/ArrowDown for message history navigation - // ArrowUp: only when input is empty (so pressing Up at start of text just moves cursor) + // ArrowUp: only when cursor at start (position 0) or input is empty // ArrowDown: also works when cursor at end (to cycle forward through history) const isAnyAutocompleteOpen = showCommandAutocomplete || showSkillAutocomplete || showSnippetAutocomplete || showFileMention; + const cursorAtStart = textareaRef.current?.selectionStart === 0 && textareaRef.current?.selectionEnd === 0; const cursorAtEnd = textareaRef.current?.selectionStart === message.length && textareaRef.current?.selectionEnd === message.length; - const canNavigateHistoryUp = !isAnyAutocompleteOpen && message.length === 0; + const canNavigateHistoryUp = !isAnyAutocompleteOpen && (message.length === 0 || cursorAtStart); const canNavigateHistoryDown = !isAnyAutocompleteOpen && (message.length === 0 || cursorAtEnd); // Markdown-aware auto-pairing (source mode), normal input only.