Bug 423253 - Caret gets stuck when moving vertically through soft-wrapped lines.
Summary: Caret gets stuck when moving vertically through soft-wrapped lines.
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: part (other bugs)
Version First Reported In: 20.04.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 318387 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-06-20 03:13 UTC by Pat Brown
Modified: 2022-01-12 15:02 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 5.81
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pat Brown 2020-06-20 03:13:35 UTC
SUMMARY
When moving vertically through a wrapped line and the current column is close to the soft-wrap position, the caret will jump to the first column of the line below. This can cause the it to skip a line when moving down, or get "stuck" when moving up.

STEPS TO REPRODUCE
1. Type: 123456 1234 123456789 12345 1234 12345
2. Adjust the window width so the text wraps to six lines.
3. Position the caret after the '6' in the third line.
4. Press the up key, up, up again, then down, then down, then down again.

OBSERVED RESULT
(Actual results may be depend on font and screen resolution. This was reproduced with Hack 9pt at 166dpi.)
The second up keypress moves the caret to the start of line 2 instead of line 1. Moving up again doesn't cause the caret to move. When it moves down it returns to the original column on line 3. Then jumps over line 4. And the last down keypress moves it to the end of line 6.

Furthermore, adding an extra space at the end of the line changes which column the bug occurs on.

EXPECTED RESULT
When the caret begins after the '8' of line three, the same sequence always result in the caret moving to a different line and the last column less than or equal to where it started.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.19.1
KDE Frameworks Version: 5.71.0
Qt Version: 5.15.0
Kate version: 20.04.2
Kate Part version: 5.71.0
Arch Linux, Kernel version 5.7.2-arch1-1
Xorg version 1.20.8

ADDITIONAL INFORMATION

Happens in KWrite as well. Which is to be expected.
Comment 1 Justin Zobel 2020-11-13 05:40:07 UTC
Confirmed the moving down skips line 4 but not the moving up.

Needs investigation.
Comment 2 n3wance 2021-02-26 05:22:15 UTC
I'd like to bump this, I ran into this bug recently and its very annoying.
Comment 3 Bug Janitor Service 2021-03-15 18:35:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/119
Comment 4 Bug Janitor Service 2021-03-17 03:26:26 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/120
Comment 5 Pat Brown 2021-03-17 16:49:50 UTC
Git commit 80762d259b20373876db6a8622cf17329db7221c by Tom N Harris, on behalf of Pat Brown.
Committed on 17/03/2021 at 03:20.
Pushed by cullmann into branch 'master'.

Restrict horizontal range of cursor to avoid unintentionally wrapping.

When converting a x position to cursor column for a wrapped text line,
the last column should not be used or else the cursor will jump to the
next line.

M  +4    -0    src/render/katerenderer.cpp

https://invent.kde.org/frameworks/ktexteditor/commit/80762d259b20373876db6a8622cf17329db7221c
Comment 6 Waqar Ahmed 2022-01-12 15:02:33 UTC
*** Bug 318387 has been marked as a duplicate of this bug. ***