gyscos / cursive

A Text User Interface library for the Rust programming language
MIT License
4.26k stars 243 forks source link

Scroll the whole page on PageDown/PageUp #761

Closed azat closed 1 year ago

gyscos commented 1 year ago

Hi, and thanks for the PR!

I'd probably scroll by the screen height minus 1 (but with a minimum of 1), so the last line before pressing scroll-down is still visible at the top. What do you think?

azat commented 1 year ago

I'd probably scroll by the screen height minus 1 (but with a minimum of 1), so the last line before pressing scroll-down is still visible at the top. What do you think?

Initially I did the same as less does - it scroll the whole page page (on PageUp/PageDown). I think that here it is better to preserve behavior of some existing tool, and less looks like a good example to follow.

But if you still think that the last line should be preserved, I've pushed a patch on top that does this, feel free to apply either only the first one, or the whole patch set.

gyscos commented 1 year ago

Indeed, it seems different application use different configurations:

I agree that scroller should probably behave more like a pager than an editor (editable views like TextArea would implement their own page-down handling).

gyscos commented 1 year ago

I merged the first commit.