Page Up / Page Down keys don't behave as expected
-
[x] Searched existing issues to avoid creating duplicates.
-
[x] Confirmed that it can be reproduced in built-in themes without customized css.
-
[x] Searched http://support.typora.io/
Describe the bug Page Up and Page Down keys don't behave as expected.
Expected behavior In essence, I expect PgUp / PgDn to scroll the viewport "one page" of text, and to move the cursor to somewhere on the newly-visible page, so that if I press PgUp several times and then press PgDn, I can scroll back and forth, like using the mousewheel but much faster.
To Reproduce
Any sort of lengthy file will do.
- Click in the middle of a paragraph.
- Hit the Page Up key.
Observed: The cursor jumps to the beginning of this paragraph, and the viewport scrolls so that the new cursor location is at the top of the viewport. Expected: The cursor should jump up "one page" worth of text, and the viewport should scroll to show the new cursor location somewhere in the middle of the viewport.
- Hit the Page Up key a few more times.
Observed: The viewport scrolls up "one page" for each keypress, as expected. However, the cursor does not move. Expected: The cursor should move with the viewport. This can be confirmed by:
- Press right-arrow.
Observed: The viewport scrolls back to the cursor location; the cursor has moved right one character.
- Click in the middle of a paragraph.
- Hit the Page Up key several times.
- Hit the Page Down key.
Observed: The viewport scrolls back to the cursor location, placing the cursor near the top of the viewport. Expected: The viewport should scroll "one page" down from its previous location.
OS: Linux (Ubuntu 21.10)
Typora Version: 1.0.3
Confirming. Pressing PgDown many times and then PgUp once, the point with the cursor becomes visible again, instead of undoing the las PgDown. (document with many images and equations, windows, typora 1.2.5).
Elaboration: It appears that the primary? behavior of PgUp / PgDn is to move the cursor to the beginning / end of the current paragraph. This is what's responsible for the viewport jumping; if you hit PgDn, (1) the cursor moves to the end of the paragraph (2) the viewport scrolls (3) the viewport scrolls. If you then hit PgUp, the cursor moves to the beginning of the paragraph, which causes the viewport to scroll back to the new cursor location.
Running into this as well on Windows 10 Pro 21H2 OS Build 19044.2130 (64 bit) on latest typora I think is available 1.4.8
Very frustrating issue since it forces you to use your mouse to navigate to scroll bar to scroll through pages manually rather than simple pageup pagedown button presses for large documents
Please note that the expected behavior on macOS for PgUp/PgDown is to move the viewport but leave the cursor alone entirely. This is the current behavior of Typora. So if this is changed, it should only be changed for Windows.
This is my first post. I'm also experiencing the page up/down buttons not behaving as expected in 1.11.5 (running on Ubuntu snap). As an aside, I noticed the page up/down implementation in Joplin are perfect. Are y'all able to use/cite their code for an easy fix?