forked from qt-creator/qt-creator
ClangFormat: Do not remove empty lines while only indenting
Insert dummy text into empty lines also for the electic characters not to remove empty lines when only indentation is intended. Fixes: QTCREATORBUG-22050 Change-Id: Ife5374459feb510a0587880a6772c90a2d68d70e Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -362,6 +362,23 @@ TEST_F(ClangFormat, IndentEmptyLineAndKeepPreviousEmptyLines)
|
||||
"}"));
|
||||
}
|
||||
|
||||
TEST_F(ClangFormat, IndentOnElectricCharacterButNotRemoveEmptyLinesBefore)
|
||||
{
|
||||
insertLines({"{",
|
||||
" ",
|
||||
" ",
|
||||
"if ()",
|
||||
"}"});
|
||||
|
||||
indenter.indentBlock(doc.findBlockByNumber(3), '(', TextEditor::TabSettings());
|
||||
|
||||
ASSERT_THAT(documentLines(), ElementsAre("{",
|
||||
" ",
|
||||
" ",
|
||||
" if ()",
|
||||
"}"));
|
||||
}
|
||||
|
||||
TEST_F(ClangFormat, IndentFunctionBodyButNotFormatBeforeIt)
|
||||
{
|
||||
insertLines({"int foo(int a, int b,",
|
||||
|
||||
Reference in New Issue
Block a user