japanoise / emsys

ersatz-emacs text editor
MIT License
3 stars 2 forks source link

Implement Emacs style Page Up/Down #40

Open nicholascarroll opened 3 months ago

nicholascarroll commented 3 months ago

Page up/down is intended to scroll the view an entire screen height (or perhaps leave a couple lines overlap) and for this reason the cursor should be moved to be just inside the window after paging up/down. I mean, if we are paging down, the cursor will land at the top of the window, and if we are paging up the cursor will keep landing at the bottom of the window. emsys doesn't do this - it advances the cursor the whole window height, which is incorrect.

Additionally, Emacs by default pages not one window height but 2 rows less. So if your cursor was on the last row or the second last row of the window, and you page down, the cursor will not have moved rows. I have introduced the constant page_overlap for this purpose and delcared it near the top of main.c (could define it in config.h but I am wary of beginning to build a configuration framework).

So this would be an enhancement to add after the separate window scrolling and the toggle-truncate-lines features have bedded down.