summaryrefslogtreecommitdiff
path: root/libview/ev-document-model.c
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2018-09-04 14:22:04 +0200
committerraveit65 <[email protected]>2018-10-20 18:04:55 +0200
commitc9ea2a34dc33224bdcc34286b3424eff44ddbe8f (patch)
treed09b64c6b48ee51beaf72e3936c142bb2edac38f /libview/ev-document-model.c
parentdeca1c1c20be5d29d0d2bfc2d6f9ed7c8e6d25f8 (diff)
downloadatril-c9ea2a34dc33224bdcc34286b3424eff44ddbe8f.tar.bz2
atril-c9ea2a34dc33224bdcc34286b3424eff44ddbe8f.tar.xz
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/dddd98b4c7922e2906bba6a31afa07837ae6c39c
Diffstat (limited to 'libview/ev-document-model.c')
0 files changed, 0 insertions, 0 deletions