SUMMARY Testing a python script, I attempted to toggle comments on a few blocks of code, the toggle instead added indefinitely to the existing comment symbol (not automatically, each press adds a new symbol) STEPS TO REPRODUCE 1. Create a basic script, here's an example: def main(): print("hello world") if 1 == 1: print("yes") print("after") if __name__ = '__main__': main() 2. Highlight portions you wish to comment out, hit the toggle comment shortcut (default is ctrl + /), then hit it again, if multiple blocks of code are highlighted, like both the function and the if statement at the bottom, it seems to add more comment characters instead of un-commenting what you just commented (goes for existing comments as well) OBSERVED RESULT Additional comment symbols added EXPECTED RESULT Toggle between a line being commented and not (adding/removing symbol as needed) SOFTWARE/OS VERSIONS Linux: EndeavourOS, Gnome DE (wayland support :/ ) KDE Plasma Version: KDE Frameworks Version: Qt Version: ADDITIONAL INFORMATION I attempted to find where this code is in gitlab, but couldn't seem to find the lines that were for toggle comment as the only things mentioning "toggle comment" exactly were some .docbook files - so am not able to determine the issue myself. **I will happily dive into the code as well if someone can point me to the right spot to look**
The "toggle comment" code is probably in KTextEditor => https://lxr.kde.org/source/frameworks/ktexteditor/src/view/kateview.cpp You can use LXR to search in all the KDE code => https://lxr.kde.org/search?%21v=kf5-qt5&_filestring=&_string=%22toggle+comment%22 (beware, this link is slow to produce result because it search a string in the code).
I have tested on the version provided by Kubuntu 22.04 (Kate 21.12.3 and KDE Frameworks 5.92) and I reproduce your issue (the behavior is the same like we comment the line with Ctrl + D). But on the master, I don't reproduce the issue (toggle comment works as expected). Do you confirm that?
Seems a duplicate of https://bugs.kde.org/show_bug.cgi?id=451471 (which have been fixed in KDE Frameworks 5.93).
*** This bug has been marked as a duplicate of bug 451471 ***