Bug 508522

Summary: regression: block selection mode causes text to become invisible when highlighting is enabled
Product: [Applications] kate Reporter: S. Christian Collins <s_chriscollins>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: waqar.17a
Priority: NOR    
Version First Reported In: 25.08.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: document that exhibits the bug
video showing the bug

Description S. Christian Collins 2025-08-20 16:00:41 UTC
Created attachment 184286 [details]
document that exhibits the bug

SUMMARY
In recent versions of Kate (and also Kwrite), using block selection mode causes text to become invisible when highlighting is enabled. I'm not sure when this bug was introduced, but it wasn't until somewhat recently.

STEPS TO REPRODUCE
1. Download and open the attached document in Kate (or Kwrite). Kate will recognize the document as Markdown format and apply the appropriate highlighting. 
2. Enable block selection mode (Ctrl+Shift+B).
3. Click somewhere in the middle of the first sentence and drag the cursor down.

OBSERVED RESULT
The text below the first line of the selection disappears as the selection extends downward.

EXPECTED RESULT
The text should remain visible.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Linux 42
KDE Plasma Version: 6.4.4
KDE Frameworks Version: 6.17.0
Qt Version: 6.9.1

ADDITIONAL INFORMATION
I was also able to reproduce the bug using the KDE neon unstable live ISO built today, featuring Kate version 25.11.70.
Comment 1 S. Christian Collins 2025-08-20 16:03:32 UTC
Created attachment 184287 [details]
video showing the bug
Comment 2 Waqar Ahmed 2025-08-21 07:03:17 UTC
Git commit 6138231b5956601b9430e3d9238cc0159abde0cf by Waqar Ahmed.
Committed on 21/08/2025 at 06:55.
Pushed by waqar into branch 'master'.

Fix selection drawing for block selection

Ensure that currentPosition falls within selection range. Selection
range in case of block selection works differently i.e., its a column
selection thus we need to handle it differently.

M  +39   -1    autotests/src/kateview_test.cpp
M  +5    -1    src/render/katerenderer.cpp

https://invent.kde.org/frameworks/ktexteditor/-/commit/6138231b5956601b9430e3d9238cc0159abde0cf