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/indenter.h | |
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/indenter.h')
-rw-r--r-- | src/plugins/texteditor/indenter.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/plugins/texteditor/indenter.h b/src/plugins/texteditor/indenter.h index 5b4b97fbfa..a9fb5de7cd 100644 --- a/src/plugins/texteditor/indenter.h +++ b/src/plugins/texteditor/indenter.h @@ -81,6 +81,21 @@ public: return -1; } + virtual void formatOrIndent(const QTextCursor &cursor, + const TabSettings &tabSettings, + int /*cursorPositionInEditor*/ = -1) + { + indent(cursor, QChar::Null, tabSettings); + } + + // By default just calls indent with default settings. + virtual Replacements format(const QTextCursor &cursor, + const TabSettings &tabSettings) + { + indent(cursor, QChar::Null, tabSettings); + return Replacements(); + } + // Expects a list of blocks in order of occurrence in the document. virtual IndentationForBlock indentationForBlocks(const QVector<QTextBlock> &blocks, const TabSettings & /*tabSettings*/) @@ -99,9 +114,6 @@ public: const TabSettings &tabSettings) = 0; - // By default just calls indent with default settings. - virtual Replacements format(const QTextCursor &cursor, const TabSettings &tabSettings) = 0; - // Reindent at cursor. Selection will be adjusted according to the indentation // change of the first block. virtual void reindent(const QTextCursor &cursor, const TabSettings &tabSettings) = 0; |