diff options
author | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2019-01-28 07:54:05 +0100 |
---|---|---|
committer | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2019-01-31 10:25:05 +0000 |
commit | 80fb0178fdd9ee82acfb22aa512c7514868e89d1 (patch) | |
tree | 7cb0a4670571ccb4183ad9b8ce6bf939a99172cc /src/plugins/texteditor/texteditor.cpp | |
parent | 9d046826f87c1971f4104ca5fc86ef58250168c5 (diff) | |
download | qt-creator-80fb0178fdd9ee82acfb22aa512c7514868e89d1.tar.gz |
ClangFormat: Introduce check to format code instead of indenting
Ctrl+I with the new check will reformat the selected code or
the current line instead.
Change-Id: Ia5a72c4a09621034d0dfe463f669fe1ca36b0b5f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Diffstat (limited to 'src/plugins/texteditor/texteditor.cpp')
-rw-r--r-- | src/plugins/texteditor/texteditor.cpp | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 872c139b69..7907259306 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -7135,21 +7135,11 @@ void TextEditorWidget::setIfdefedOutBlocks(const QList<BlockRange> &blocks) documentLayout->requestUpdate(); } -static bool applyFormattingInsteadOfIndentation() -{ - constexpr const char option[] = "QTC_FORMAT_INSTEAD_OF_INDENT"; - return qEnvironmentVariableIsSet(option); -} - void TextEditorWidget::format() { - static bool formattingInsteadOfIndentation = applyFormattingInsteadOfIndentation(); QTextCursor cursor = textCursor(); cursor.beginEditBlock(); - if (formattingInsteadOfIndentation) - d->m_document->autoFormat(cursor); - else - d->m_document->autoIndent(cursor); + d->m_document->autoFormatOrIndent(cursor); cursor.endEditBlock(); } |