Skip to content

feat(ui): Improve chat interface with natural scrolling and history preservation#290

Merged
edenreich merged 2 commits intomainfrom
feature/natural-mouse-scrolling
Nov 30, 2025
Merged

feat(ui): Improve chat interface with natural scrolling and history preservation#290
edenreich merged 2 commits intomainfrom
feature/natural-mouse-scrolling

Conversation

@edenreich
Copy link
Contributor

Summary

This PR enhances the terminal chat interface with two key improvements:

  • Natural mouse wheel scrolling: Implements proper mouse wheel scrolling behavior using Bubble Tea's built-in viewport capabilities for a more intuitive user experience
  • Chat history preservation: Persists the full conversation history in the terminal after exit, allowing users to review the complete session in their terminal scrollback

Changes

Mouse Wheel Scrolling Enhancement

  • Enabled mouse cell motion in the Bubble Tea program initialization
  • Configured viewport with MouseWheelEnabled = true and MouseWheelDelta = 3 for smooth scrolling
  • Removed custom mouse wheel handling in favor of viewport's native implementation
  • Improved scroll state tracking to properly detect when user is at bottom

History Preservation

  • Added PrintConversationHistory() method to output the conversation after exit
  • Stores rendered content in renderedContent field to maintain exact formatting
  • Modified GetPlainTextLines() to return the actual rendered content with proper text wrapping
  • Conversation now appears in terminal scrollback buffer after exiting the chat interface

Test plan

  • Verify mouse wheel scrolling works naturally in both directions
  • Confirm auto-scroll to bottom resumes when scrolling to the end
  • Test that conversation history is printed to terminal on exit
  • Verify the printed history matches the formatting shown during the chat session
  • Ensure text wrapping is preserved in the output

🤖 Generated with Claude Code

This commit implements smooth, natural mouse wheel scrolling for the chat
conversation view, addressing the limitation where users could only scroll
using Shift+Up/Down keyboard shortcuts.

Changes:
- Enable mouse support in Bubble Tea program with tea.WithMouseCellMotion()
- Configure viewport with MouseWheelEnabled and MouseWheelDelta (3 lines)
- Refactor event handling to use viewport's native mouse wheel support
- Remove custom mouse handler that was blocking natural scrolling
- Maintain scroll state tracking for auto-scroll behavior

The chat interface now provides a more intuitive scrolling experience
similar to standard terminal applications, while preserving the existing
auto-scroll-to-bottom behavior when new messages arrive.

Signed-off-by: Eden Reich <eden.reich@gmail.com>
Remove alt-screen mode and print conversation history when exiting to
preserve the full chat session in the terminal scrollback. This allows
users to review previous interactions after closing the chat interface.

Changes:
- Remove tea.WithAltScreen() to keep chat visible in terminal
- Add PrintConversationHistory() method to output chat on exit
- Store rendered content in ConversationView for accurate text export
- Update GetPlainTextLines() to use actual rendered content
- Add tea.ClearScreen on init for clean startup

Signed-off-by: Eden Reich <eden.reich@gmail.com>
@edenreich edenreich merged commit 6d2694e into main Nov 30, 2025
5 checks passed
@edenreich edenreich deleted the feature/natural-mouse-scrolling branch November 30, 2025 14:17
ig-semantic-release-bot bot pushed a commit that referenced this pull request Nov 30, 2025
## [0.74.0](v0.73.0...v0.74.0) (2025-11-30)

### 🚀 Features

* **ui:** Improve chat interface with natural scrolling and history preservation ([#290](#290)) ([6d2694e](6d2694e))
@ig-semantic-release-bot
Copy link

🎉 This PR is included in version 0.74.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments