SUMMARY So the problem is with toggling comment with ctrl+/ shortcut. If selected text contains empty lines, then this shortcut will only add more levels of comment (in python adding more # ) , but it will not add comment on the empty line, nor will remove comment if whole text (except these empty lines) is already commented. STEPS TO REPRODUCE 1. Create .yml file containing yaml config with empty line: test: test2: - whatever another: another2: hello 2. select this whole text with mouse dragging over it 3. press ctrl+/ to comment/uncomment selected text multiple times OBSERVED RESULT Additional layers of comment are added to the text: ######test: ######test2: ######- whatever ######another: ######another2: hello EXPECTED RESULT Only one level of comment is made, and then removed with every second toggling. SOFTWARE/OS VERSIONS Linux/KDE Plasma: Fedora 36 KDE Plasma Version: 5.25.4 KDE Frameworks Version: 5.97.0 Qt Version: 5.15.5 ADDITIONAL INFORMATION If instead of selecting text with mouse dragging, i put on each line multicursor (leftAlt+click) and then use toogling comments, then it works as expected.
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/407
Git commit 89c0b14fec9e42d12c1fcc5e60b5defece28a3e7 by Christoph Cullmann, on behalf of Waqar Ahmed. Committed on 21/08/2022 at 17:09. Pushed by cullmann into branch 'master'. Fix toggle comment with empty line in selection M +14 -0 autotests/src/katedocument_test.cpp M +5 -1 src/document/katedocument.cpp https://invent.kde.org/frameworks/ktexteditor/commit/89c0b14fec9e42d12c1fcc5e60b5defece28a3e7