Bug 451471 - Toggle comment for Python code no longer works if leading whitespace is present
Summary: Toggle comment for Python code no longer works if leading whitespace is present
Status: RESOLVED FIXED
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 5.91.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 451764 456534 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-03-13 21:32 UTC by Luke Horwell
Modified: 2022-07-10 10:34 UTC (History)
3 users (show)

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


Attachments
ZIP containing two GIFs demonstrating the issue (5.90 vs 5.91) (223.79 KB, application/zip)
2022-03-13 21:32 UTC, Luke Horwell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Horwell 2022-03-13 21:32:26 UTC
Created attachment 147481 [details]
ZIP containing two GIFs demonstrating the issue (5.90 vs 5.91)

SUMMARY
Since the release of ktexteditor 5.91.0, the "toggle comment" feature no longer works on Python code where whitespace is present at the start of the selection. For example, when an empty new line is included above the block, or selecting multiple lines which are indented.

Affects KWrite, Kate and KDevelop. Downgrading to 5.90.0 restores the expected behaviour.

STEPS TO REPRODUCE
1. In a Python document, select multiple lines which are indented (an example of leading whitespace on a line)
2. Press CTRL+/ to toggle the comment.

OBSERVED RESULT
Toggling comments only ever comments, and does not uncomment. Please observe the attached zip of GIFs demonstrating this.

EXPECTED RESULT
The line would be commented and uncommented.

ADDITIONAL INFORMATION
According to a git bisect, the problematic commit starts at:
690e16d5e06477d5f504d1ab89c760cb0cdcf4ff "Fix comment toggling when all lines in selection aren't commented"
https://invent.kde.org/frameworks/ktexteditor/-/commit/690e16d5e06477d5f504d1ab89c760cb0cdcf4ff

SOFTWARE/OS VERSIONS
OS: Arch Linux
KDE Plasma Version: 5.91.0
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.3
Comment 1 Bug Janitor Service 2022-03-14 04:45:47 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/326
Comment 2 Waqar Ahmed 2022-03-14 20:28:41 UTC
Git commit 1173d5184e8b073790556dbdba92a8b8abdd62dc by Waqar Ahmed.
Committed on 14/03/2022 at 04:49.
Pushed by cullmann into branch 'master'.

Fix toggle comment with space at the start

M  +48   -0    autotests/src/katedocument_test.cpp
M  +1    -0    autotests/src/katedocument_test.h
M  +9    -1    src/document/katedocument.cpp

https://invent.kde.org/frameworks/ktexteditor/commit/1173d5184e8b073790556dbdba92a8b8abdd62dc
Comment 3 Waqar Ahmed 2022-03-21 13:26:21 UTC
*** Bug 451764 has been marked as a duplicate of this bug. ***
Comment 4 Waqar Ahmed 2022-07-10 10:34:32 UTC
*** Bug 456534 has been marked as a duplicate of this bug. ***