[kate] [Bug 502233] Extreme slowdown on selecting text in small file
https://bugs.kde.org/show_bug.cgi?id=502233 Christoph Cullmann changed: What|Removed |Added Status|ASSIGNED|RESOLVED Latest Commit||https://invent.kde.org/fram ||eworks/ktexteditor/-/commit ||/0cb99379131b6fb2b80637e6e8 ||6da428a630f3bf Resolution|--- |FIXED --- Comment #4 from Christoph Cullmann --- Git commit 0cb99379131b6fb2b80637e6e86da428a630f3bf by Christoph Cullmann, on behalf of Waqar Ahmed. Committed on 12/06/2025 at 19:45. Pushed by cullmann into branch 'master'. Draw selection background ourselves We were using the "selectionFormats" parameter of QTextLayout::draw() to draw selections and supplied background + foreground formats for drawing selections. This leads to extremely poor performance when there are a lot of "selection formats" e.g., a large list of numbers on a single line. To fix this, draw the selection background ourselves and handle the foreground formats during text layouting phase. M +5-22 src/render/katerenderer.cpp https://invent.kde.org/frameworks/ktexteditor/-/commit/0cb99379131b6fb2b80637e6e86da428a630f3bf -- You are receiving this mail because: You are watching all bug changes.
[kate] [Bug 502233] Extreme slowdown on selecting text in small file
https://bugs.kde.org/show_bug.cgi?id=502233 Bug Janitor Service changed: What|Removed |Added Status|CONFIRMED |ASSIGNED --- Comment #3 from Bug Janitor Service --- A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/815 -- You are receiving this mail because: You are watching all bug changes.
[kate] [Bug 502233] Extreme slowdown on selecting text in small file
https://bugs.kde.org/show_bug.cgi?id=502233 Christoph Cullmann changed: What|Removed |Added CC||[email protected] --- Comment #2 from Christoph Cullmann --- (In reply to Waqar Ahmed from comment #1) > The slowdown is in Qt. Its unable to handle a large number of format ranges > that are produced by KateRenderer::decorationsForLine when the ranges are > passed to QTextLayout::draw(). During text layouting this is not an issue. > > One possible fix could be to render selection ourselves always: > - remove the following check in decorationsForLine so that we use the > correct foreground color during layouting. This will have implications for > printing and screenshot so that needs to be kept in mind: > if (selectionsOnly) { > assignSelectionBrushesFromAttribute(fr, *a); > } > - Dont use Qt for selection background. Use our own function > paintTextBackground, that function needs a bit more testing, I think its > still a little bit broken with multiple wrapped lines > > On quick testing, this removes all lag. Given we do most other painting ourself, too, that would be fine with me. -- You are receiving this mail because: You are watching all bug changes.
[kate] [Bug 502233] Extreme slowdown on selecting text in small file
https://bugs.kde.org/show_bug.cgi?id=502233 Waqar Ahmed changed: What|Removed |Added CC||[email protected] Ever confirmed|0 |1 Status|REPORTED|CONFIRMED --- Comment #1 from Waqar Ahmed --- The slowdown is in Qt. Its unable to handle a large number of format ranges that are produced by KateRenderer::decorationsForLine when the ranges are passed to QTextLayout::draw(). During text layouting this is not an issue. One possible fix could be to render selection ourselves always: - remove the following check in decorationsForLine so that we use the correct foreground color during layouting. This will have implications for printing and screenshot so that needs to be kept in mind: if (selectionsOnly) { assignSelectionBrushesFromAttribute(fr, *a); } - Dont use Qt for selection background. Use our own function paintTextBackground, that function needs a bit more testing, I think its still a little bit broken with multiple wrapped lines On quick testing, this removes all lag. -- You are receiving this mail because: You are watching all bug changes.
