Skip to content

Support terminal scrolling - #2

Open
geoffjay wants to merge 1 commit into
zortax:mainfrom
geoffjay:scroll
Open

Support terminal scrolling#2
geoffjay wants to merge 1 commit into
zortax:mainfrom
geoffjay:scroll

Conversation

@geoffjay

@geoffjay geoffjay commented Feb 6, 2026

Copy link
Copy Markdown

Tested this by doing:

  • start example with cargo run
  • execute opencode which uses an alternative method of scrolling
  • generate output that exceeds the view
  • scroll

@zortax zortax left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey thanks for the contribution!
Two things I noticed with this:

  • scrolling direction seems to be wrong way around on my system
  • in e.g. nvim, scrolling seems much faster than in other terminal emulators

Additionally, I think it would be nice to render a small indicator/scrollbar when scrolled up (configurable) and also, the view should jump back down on input.

Feel free to address those things, otherwise I'll work on this next week :)

Comment thread src/view.rs
Comment on lines +795 to +801
// Calculate number of lines to scroll
// Note: We negate the delta because:
// - On macOS with natural scrolling, swipe up gives negative y delta
// - But swipe up should show OLDER content (positive scroll offset)
// - For scroll_display, positive delta scrolls toward history (older content)
let pixel_delta = event.delta.pixel_delta(px(20.0)).y;
let lines = -pixels_to_scroll_lines(pixel_delta, self.renderer.cell_height);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about expected behavior on macOS, but on my linux machine this scrolls the wrong way around (I have to scroll "down" to go up)

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