Bug 407549

Summary: On continuous view, if >2 pages fit on-screen, left/right arrows inconsistent (next/previous page)
Product: [Applications] okular Reporter: nyanpasu64 <nyanpasu64>
Component: generalAssignee: Okular developers <okular-devel>
Status: CONFIRMED ---    
Severity: normal CC: kdedev
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Video of bug happening.

Description nyanpasu64 2019-05-15 06:50:36 UTC
SUMMARY
If I enable continuous mode and zoom out until over 2 pages fit on screen at once (eg. widescreen PDF slides), then scrolling computes page number using center of screen, but left/right arrows aligns selected page to top of screen.

STEPS TO REPRODUCE
1. Open a PDF document and zoom out until over 2 pages fit on screen.
    - The bottom of the screen says page 1 (top of screen).
2. Press right arrow to enter page 2.
    - The bottom of the screen says page 2 (top of screen).
3. Scroll down and up.
    - The position of the document is identical to "after step 2", however...
    - The bottom of the screen says page 3 (center of screen).

If you press left/right arrow after step 2, you will end up on page 1/3.
If you press left/right arrow after step 2, you will end up on page 2/4.

EXPECTED RESULT
I'm not sure how to fix this behavioral inconsistency. I personally want a choice in the Settings menu between multiple different behaviors, but you can hard-code one of the behaviors, or find another internally-consistent and user-friendly solution.

## Top of screen

`top_float` = "page number at top of screen" (similar to left/right arrow today). Defaults to 1.0 when opening a document. Scrolling half of page 1 off-screen = 1.5.

I want pressing (left, right) for the following `top_float` to set `top_float` to:

2 -> (1, 3)
2.01 to 2.99 -> (2, 3)

- Left arrow moves to page `ceil(top_float) - 1`
- Right arrow moves to page `floor(top_float) + 1`
- The page number is displayed as `floor(top_float)`

## "Centered Page" in scare-quotes

`top_float` = "page number at top of screen" (as above).
`center_float` = "page number at center of screen" (similar to Okular scrolling today).

I want pressing (left, right) for the following `top_float` to set `top_float` to:

1.5 to 2.49... -> (1, 3)
2.5 to 3.49... -> (2, 4)

- Left arrow moves to page `round(top_float) - 1`???
- Right arrow moves to page `round(top_float) + 1`???
- The page number is displayed as `round(top_float)` (matches left/right arrows).

Currently, Okular uses this approach, but with `floor(center_float)` instead, which suffers from the above-mentioned consistency issues.

------

A previous version of Windows Foxit used "top of screen" behavior for left/right arrows (which I disliked at the time), but an update changed it to "center of screen" behavior (and now I want the older behavior back XD).

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 18.04
(available in About System)
KDE Plasma Version: 5.12.7
KDE Frameworks Version: 5.44.0
Qt Version: 5.9.5

ADDITIONAL INFORMATION
Okular versions with bug:
Ubuntu: 1.5.70
Flatpak flathub: 1.7.0
Flatpak kdeapps: 1.7.70 master, commit f741df1186ad
Comment 1 nyanpasu64 2019-05-16 09:40:08 UTC
If using "Centered Page" behavior, I think it would make sense to keep current behavior (floor(center_float)) when pages are over 1 screen tall.

floor(center_float): we properly switch to `currently visible page +- 1 page`.

round(top_float): If over half the current page is off-screen, we will switch to `current page or +2`, which is confusing.
Comment 2 TraceyC 2024-06-05 19:15:58 UTC
Thank you for the bug report. Unfortunately we were not able to get to it yet. 

I just tested this on Plasma 5 with Okular 24.02.2, and I am not able to replicate the bug. When I use the arrows to move between pages, the correct page number is shown in the bottom toolbar.

Can we ask you to please check if this is still an issue with either Plasma 5.27 (the current LTS version) or Plasma 6.0.5 (the latest released version)? Thanks.
Comment 3 Bug Janitor Service 2024-06-20 03:47:11 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 nyanpasu64 2024-06-20 21:27:19 UTC
Created attachment 170707 [details]
Video of bug happening.

Still happens on 24.05.1 (see video). If I scroll up and down, then press the right arrow key, Okular jumps two pages down. (If you instead press left arrow, the screen does not move.)

If you are "not able to replicate the bug", you may have missed the step where you "zoom out until over 2 pages fit on screen at once".
Comment 5 TraceyC 2024-06-27 19:24:51 UTC
Thank you for re-testing and for the video.

To clarify, I had followed the steps in the original post precisely. I think I had just misunderstood the behavior you were trying to highlight.

I just tested again after watching the video and can confirm the undesired behavior.

Note: I see that the page numbers are now at the top of Okular in the video (in the original report they were described as being at the bottom).


Setup:
10 page PDF open in Okular
Zoom set at 38%, which on my screen shows 2 1/3 pages
Thumbnails panel hidden (the inconsistent behavior is even more obvious if you show them)
Page numbers shown in top and bottom panels (I had added them to the bottom in my prior test)

Steps for first described behavior (pagination when scrolling and using arrows):
1. Opened the document, it opened in the middle.
2. Scrolled to the top of the document.
  - Page number shows 2 of 10 (middle of screen)
3. Use the up arrow to make the pager show page 1
4. Press right arrow to get to page 2
  - Page number shows 2 (top of screen)
5. Scroll down and up until the top of page 2 is at the top of the viewport.
  - If page 2 is at the top of the screen, the pager shows page 3 (center of screen)
  - If page 2 is at the top, the pager shows page 2 (center of screen)

Steps for second behavior "after step 2" (pagination when only using arrows):
1. Scrolled to the top of the document, pressed left arrow to get the pager to show 1
2. Press right arrow to get to page 2
  - Page number shows 2 (top of screen)
3. Press left arrow
  - Page number shows 1 (top of screen)
4. Press right arrow to get to page 2
  - Page number shows 2 (top of screen)
5. Press right arrow
  - Page number shows 3 (top of screen)