https://bugs.kde.org/show_bug.cgi?id=438744
--- Comment #4 from Christoph Cullmann <cullm...@kde.org> --- Git commit 93d6b7aebe7940cc63657f6d8df141fe02dee964 by Christoph Cullmann, on behalf of Waqar Ahmed. Committed on 25/08/2022 at 16:14. Pushed by cullmann into branch 'master'. Improve singleline selection commenting Currently, if you have a selection and "afterwhitespace" turned on for the language that you are using and you do a selection and comment it out it leads to a really bad result with languages like C/C++. Following code: ```c++ for (auto x : list) { if (x > 1) printf("%d", x); } ``` will become ```c++ // for (auto x : list) { // if (x > 1) // printf("%d", x); // } ``` Which makes zero sense. With this change, the comment marker will be placed at the smallest indent found in the selection, which can be 0. For the above code, the result will be: ```c++ // for (auto x : list) { // if (x > 1) // printf("%d", x); // } ``` Comments are nicely aligned, and we keep the indentation. This behaviour is consistent with other editors for e.g., vscode, sublime. Its also compatible with what for e.g clang-format or prettier do, i.e., align the comments according to indentation setting. Related: bug 456819 M +3 -3 autotests/src/katedocument_test.cpp M +44 -15 src/document/katedocument.cpp https://invent.kde.org/frameworks/ktexteditor/commit/93d6b7aebe7940cc63657f6d8df141fe02dee964 -- You are receiving this mail because: You are watching all bug changes.