Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
Qt Creator 4.9.0-rc1
-
None
-
Qt Creator 4.9.0-rc1
macOS 10.14.4
-
6f745e0a4def20176f7ae5d1609cabe847de466f (qt-creator/qt-creator/4.9)
Description
Steps to reproduce:
- Delete ~/.config/QtProject
- Launch Qt Creator, enable the experimental ClangFormat plugin, and restart
- Open the attached project in Qt Creator — the project contains a .clang-format file specifying that tabs should be used for indentation
- Open main.cpp
- Move the cursor after the open curly brace and press Enter
- Type return 0; (do not press Enter)
- (Note that the return 0; line is indented using a tab — good)
- File > Save
- (Note that now the return 0; line is indented using 4 spaces — bad)
If I run clang-format main.cpp from the command line, it correctly indents using a tab.
This bug seems to happen only for one-line functions. If the function has 2 or more lines, it correctly indents using tabs.