Bug 513587

Summary: The selection is displayed wrong with Dynamic word wrap and whitespace in front of the line.
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: Ondřej Mach <ondrej.mach>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: 6.21.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Ondřej Mach 2025-12-19 20:18:27 UTC
SUMMARY
Suppose you have a long line in Kate with Dynamic word wrap turned on. Then, you add some whitespace in front of that line. When you select the text on that line, the selection 'highlighting' is displayed to the left of the actual text. The issue is only that the selection shows wrong - when you hit Ctrl+X, the correct text disappears. This bug appears in both Kate and KWrite.

STEPS TO REPRODUCE
1. Start Kate and turn on 'View > Word wrap > Dynamic word wrap'
2. Write a long one-line text spanning at least 3 wrapped lines (the first and the last line are not affected)
3. Write some spaces in front of the long line (both spaces and tabs work)
4. Select the whole text

OBSERVED RESULT
The selection highlighting is shifted to the left on all lines except the first and the last.

EXPECTED RESULT
The selection highlighting should be aligned with the selected text.

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 43
KDE Plasma Version: 6.5.4
KDE Frameworks Version: 6.21.0
Qt Version: 6.10.1