| Summary: | Indenting a selection that starts or ends in leading whitespace changes the selection | ||
|---|---|---|---|
| Product: | [Frameworks and Libraries] frameworks-ktexteditor | Reporter: | Ivan Yosifov <iyosifov> |
| Component: | general | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | christoph, iyosifov, remiforkdebugreport |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Arch Linux | ||
| OS: | Linux | ||
| Latest Commit: | https://invent.kde.org/frameworks/ktexteditor/-/commit/02d2aa2984a54fb63b586448b8d859a514ad285b | Version Fixed/Implemented In: | 5.112 |
| Sentry Crash Report: | |||
| Attachments: |
selection anchors in text, 0 tabs
selection anchors in text, 1 tab selection anchors in text, 2 tabs selection anchors in leading whitespace, 0 tabs selection anchors in leading whitespace, 1 tab selection anchors in leading whitespace, 2 tabs Proposed fix |
||
|
Description
Ivan Yosifov
2013-12-26 13:59:18 UTC
Created attachment 84272 [details]
selection anchors in text, 0 tabs
Created attachment 84273 [details]
selection anchors in text, 1 tab
Created attachment 84274 [details]
selection anchors in text, 2 tabs
Created attachment 84275 [details]
selection anchors in leading whitespace, 0 tabs
Created attachment 84276 [details]
selection anchors in leading whitespace, 1 tab
Created attachment 84277 [details]
selection anchors in leading whitespace, 2 tabs
Created attachment 85443 [details] Proposed fix This patch fixes the bug for me. When the selection end is in leading whitespace, it moves to the end of the leading whitespace and not the beginning of the line. For this bug both insertBehavior == ExpandRight and ExpandLeft | ExpandRight work fine, but the second is used, to not regress https://bugs.kde.org/show_bug.cgi?id=279910 . HELLO !? Hi, sorry we didn't take a look earlier, thought I am not sure if that change would not cause other regressions. I have been able to reproduce this bug in a unit test. If I can, I'll propose a fix that only involves the indent/unindent part of the code. A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/623 Git commit 02d2aa2984a54fb63b586448b8d859a514ad285b by Christoph Cullmann, on behalf of Rémi Peuchot. Committed on 31/10/2023 at 16:30. Pushed by cullmann into branch 'kf5'. Fix selection shrink when indenting 'editRemoveText' indirectly triggers 'TextRange::checkValidity' which silently shrink the selection if the removed text is at the start or end of the given range. 'editInsertText' will insert text without expanding the selection. The fix consists of doing insertion before deletion so that the selection is not shrinked. (more details in the Merge Request) FIXED-IN:5.112 (cherry picked from commit 00f218cdf0adce8b0e0b96fd0107803946848e07) M +5 -2 src/utils/kateautoindent.cpp https://invent.kde.org/frameworks/ktexteditor/-/commit/02d2aa2984a54fb63b586448b8d859a514ad285b |