Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Oct 16, 2025

Pressing up arrow on an empty input now edits the last user message, providing a quick way to iterate without clicking edit.

Changes

  • ChatInput: Added keyboard handler for up arrow when input is empty
  • AIView: Added handleEditLastUserMessage callback that finds last user message
  • Scroll-to-message: View smoothly scrolls to center the message being edited
  • Jump indicator: Jump-to-bottom indicator appears immediately after scroll

Cleanup

While implementing this, also cleaned up related code:

  • Fixed placeholder to use CANCEL_EDIT keybind instead of CANCEL
  • Removed redundant empty CANCEL keybind handler
  • Removed redundant NEW_LINE handler (matchesKeybind already handles Shift+Enter)

Testing

Manually test:

  1. Send a message
  2. Clear input and press up arrow → should edit last message with smooth scroll
  3. Jump-to-bottom indicator should appear immediately
  4. Type something and press up arrow → should move cursor normally
  5. Press Shift+Enter → should still insert newline

Generated with cmux

@ammar-agent ammar-agent force-pushed the up-arrow branch 2 times, most recently from adf442a to d225c0d Compare October 16, 2025 00:21
When the input is empty and not editing, pressing up arrow now edits the
last user message. This provides a quick way to iterate on messages without
clicking the edit button.

Also cleaned up related code:
- Fixed placeholder to use CANCEL_EDIT keybind instead of CANCEL
- Removed redundant empty CANCEL keybind handler
- Removed redundant NEW_LINE handler (matchesKeybind already handles it)

Net: +11 LOC
When pressing up arrow on empty input to edit the last user message, the view
now smoothly scrolls to center the message being edited. This improves UX by
making it clear which message is being edited.

Net: +9 LOC
@ammario ammario marked this pull request as ready for review October 16, 2025 03:44
@ammario ammario enabled auto-merge October 16, 2025 03:44
When scrolling to edit a message via up arrow, explicitly disable auto-scroll
so the jump-to-bottom indicator appears immediately. Previously it wouldn't
show until you manually scrolled because scrollIntoView() is programmatic
scrolling which the scroll handler intentionally ignores.

Net: +2 LOC
@ammario ammario added this pull request to the merge queue Oct 16, 2025
Merged via the queue into main with commit 3e774c5 Oct 16, 2025
8 checks passed
@ammario ammario deleted the up-arrow branch October 16, 2025 04:02
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.

2 participants