Skip to content

feat(input): add ArrowUp/ArrowDown input history navigation#296

Open
c-rick wants to merge 1 commit intolukilabs:mainfrom
c-rick:feat/input-history
Open

feat(input): add ArrowUp/ArrowDown input history navigation#296
c-rick wants to merge 1 commit intolukilabs:mainfrom
c-rick:feat/input-history

Conversation

@c-rick
Copy link
Copy Markdown

@c-rick c-rick commented Feb 26, 2026

This pull request adds per-session input history navigation to the chat input component, enabling users to recall previous messages with ArrowUp/ArrowDown keys. It also improves cursor position tracking for the rich text input. The most important changes are grouped below.

Input History Navigation Enhancements:

  • Added a memoized userHistory array in ChatDisplay.tsx to collect trimmed user messages in reverse order for input history navigation.
  • Passed userHistory as the inputHistory prop to FreeFormInput, and updated the FreeFormInputProps interface to support this feature. [1] [2]
  • Implemented ArrowUp/ArrowDown key handling in FreeFormInput.tsx to navigate through input history when the cursor is at the start/end of the input, including draft preservation and restoration logic.
  • Improved session switching logic in FreeFormInput.tsx to reset input history navigation and restore drafts appropriately.
  • Reset history draft on input submission to avoid stale drafts.

Rich Text Input Improvements:

  • Added a selectionchange event listener in rich-text-input.tsx to keep the cursor position reference up-to-date, ensuring correct cursor tracking during navigation and editing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant