In c++, with automatic brackets on, indentation set to "C style" and using tabs, when I write something that uses brackets (for example the body of an if-case), the brackets go to wrong positions and the indentation is all bad. For example (____ means tab, . means space, | is the caret position): I have something like this: int main() { ____while(true)| } I press <enter> and go to the next line (as expected with the one extra indentation more than the while line). Then, pressing the '{' key results in this: int main() { ____while(true) .{|} } Notice that the indentation is wrong and using a single space instead of a tab. The cursor is inside the brackets, as expected. If I press <enter> once again, I get this: int main() { ____while(true) .{ ____.| } } That is: the first bracket has an space instead of a tab; the body part (where the caret is) has a tab, as expected, but then a single space (instead of a second tab); and the second bracket has no indentation at all. I'm using kubuntu 16.04 but with a ppa to get stable kde backports and another for kdevelop. Kate says that it is version 16.04.3, using KDE Frameworks 5.28.0, Qt 5.6.1 (built against 5.6.1), and the xcb windowing system. KDE Plasma Version is 5.8.5. Qt Version is 5.6.1.
Confirmed. To trigger this, you only need to set "Indentation using" to tabs. Leave everything else as defaults. Arch packages (KDE frameworks 5.58.0, Qt 5.12.3, Kwrite version 19.04.1) are newer, so I'll update the version for this bug. Note: When Indentation is set to use spaces, this behavior does NOT happen. Example and behavior with indentation using spaces: Start with, int main() { ....while (true)| } Press enter int main() { ....while (true) ........| } Open braces int main() { ....while (true) ....{|} } Press enter int main() { ....while (true) ....{ ........| ....} }
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/267
Git commit 29122ad59afeced0296d23fb6153c4f04c008ac1 by Christoph Cullmann, on behalf of Waqar Ahmed. Committed on 27/01/2022 at 07:11. Pushed by cullmann into branch 'master'. When using tabs, use tabs to auto indent Related: bug 367966 M +1 -1 src/script/data/indentation/cstyle.js M +1 -0 src/utils/kateautoindent.cpp https://invent.kde.org/frameworks/ktexteditor/commit/29122ad59afeced0296d23fb6153c4f04c008ac1