Hello contributors, this is a small but crucial bug.
While I was testing PR #20 by injecting failure points, I noticed that focal-point zoom (holding Ctrl while scrolling) does not work at all.
What I did
Launched the app from a terminal so stderr would be visible, opened a PDF, then held Ctrl and scrolled the wheel over the page.
python3 -m inlinea # ran from terminal so traceback is visible
# open any PDF, then hold Ctrl and scroll the mouse wheel over the page
What happened
The page never zooms, and the terminal prints:
Traceback (most recent call last):
File ".../src/inlinea/ui/pdf_view.py", line 774, in on_scroll
sx, sy = event.get_position()
^^^^^^
ValueError: too many values to unpack (expected 2)
It reproduces every time. Because the error only surfaces from a terminal launch, a user who started Inlinea from the desktop icon would just see a broken zoom with no clue why.
Why does this happen?
In on_scroll (src/inlinea/ui/pdf_view.py:774), the Ctrl branch does sx, sy = event.get_position(). Under PyGObject, Gdk.Event.get_position() returns a three-value tuple, (bool, float, float): a success flag followed by the x and y coordinates . Unpacking that into two names raises the ValueError, which aborts the handler before it ever reaches _zoom_around_focal() a few lines down, so no zoom occurs. Interestingly, the very similar call two lines later, success, pt = native.compute_point(...), already handles the flag correctly, so this looks like a single spot that got missed rather than a pattern-wide issue.
I expected Ctrl+Scroll to zoom centered on the cursor; instead nothing changes on screen.
Happy to open a small PR to add the tiny changes that'll:
- Read the success flag that
get_position() returns so the unpacking matches the value's real shape, and
- Fall back to the existing center-of-viewport focal point that
on_scroll already computes when an event carries no usable position, so cursor-centered zoom keeps working in the normal case and errors out gracefully otherwise.
Happy to leave it alone if you'd rather take it yourself, or if a larger rework of the zoom path is already on your plate. Just let me know, and thanks again!
Hello contributors, this is a small but crucial bug.
While I was testing PR #20 by injecting failure points, I noticed that focal-point zoom (holding Ctrl while scrolling) does not work at all.
What I did
Launched the app from a terminal so stderr would be visible, opened a PDF, then held Ctrl and scrolled the wheel over the page.
What happened
The page never zooms, and the terminal prints:
It reproduces every time. Because the error only surfaces from a terminal launch, a user who started Inlinea from the desktop icon would just see a broken zoom with no clue why.
Why does this happen?
In
on_scroll (src/inlinea/ui/pdf_view.py:774), the Ctrl branch doessx, sy = event.get_position(). UnderPyGObject,Gdk.Event.get_position()returns a three-value tuple,(bool, float, float): a success flag followed by the x and y coordinates . Unpacking that into two names raises theValueError, which aborts the handler before it ever reaches_zoom_around_focal()a few lines down, so no zoom occurs. Interestingly, the very similar call two lines later,success, pt = native.compute_point(...), already handles the flag correctly, so this looks like a single spot that got missed rather than a pattern-wide issue.I expected Ctrl+Scroll to zoom centered on the cursor; instead nothing changes on screen.
Happy to open a small PR to add the tiny changes that'll:
get_position()returns so the unpacking matches the value's real shape, andon_scrollalready computes when an event carries no usable position, so cursor-centered zoom keeps working in the normal case and errors out gracefully otherwise.Happy to leave it alone if you'd rather take it yourself, or if a larger rework of the zoom path is already on your plate. Just let me know, and thanks again!