Commit c9ea2a3
EvView: Fix cursor movement when logical and visual line order differs
Make sure not to move the caret in the wrong direction when restoring
the visual line X offset, in case the visual and logical order is
slightly different.
The algorithm used to move the cursor on the next line and restore the
X position across lines works as follows:
1. Move `cursor_offset` to the next line by incrementing it until
reaching a line break;
2. Find the Y coordinate corresponding to the new cursor_offset;
3. Find the text closest to the new Y coordinate and the previous X
coordinate.
4. Move cursor_offset to the text at this new (X, Y) location.
The issue lies in step 3, which can find a position on a different line
than expected in case several lines have a nearly the same Y position.
Evince references:
* https://gitlab.gnome.org/GNOME/evince/issues/889
* https://gitlab.gnome.org/GNOME/evince/merge_requests/81
* https://gitlab.gnome.org/GNOME/evince/commit/dddd98b4c7922e2906bba6a31afa07837ae6c39c1 parent deca1c1 commit c9ea2a3
1 file changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5406 | 5406 | | |
5407 | 5407 | | |
5408 | 5408 | | |
| 5409 | + | |
5409 | 5410 | | |
5410 | 5411 | | |
5411 | 5412 | | |
| |||
5475 | 5476 | | |
5476 | 5477 | | |
5477 | 5478 | | |
| 5479 | + | |
| 5480 | + | |
5478 | 5481 | | |
5479 | 5482 | | |
5480 | 5483 | | |
| 5484 | + | |
| 5485 | + | |
| 5486 | + | |
| 5487 | + | |
| 5488 | + | |
| 5489 | + | |
| 5490 | + | |
5481 | 5491 | | |
5482 | 5492 | | |
5483 | 5493 | | |
| |||
0 commit comments