diff options
author | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2019-01-28 08:11:20 +0100 |
---|---|---|
committer | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2019-01-31 10:25:18 +0000 |
commit | 1dee275f58e9f9df2e2719325157cfdec42fe1cf (patch) | |
tree | b5d3480d9484a9d0347de6d3d8219f31d70b602e /src/plugins/texteditor/textindenter.cpp | |
parent | 80fb0178fdd9ee82acfb22aa512c7514868e89d1 (diff) |
ClangFormat: Add cursor position to the indenter interface
Sometimes it's imnportant where the cursor currently is
to properly format the code without affecting the current line.
Change-Id: I8b1fb11d2303adb5f960c7cb80a0ed2e6e45010f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Diffstat (limited to 'src/plugins/texteditor/textindenter.cpp')
-rw-r--r-- | src/plugins/texteditor/textindenter.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/texteditor/textindenter.cpp b/src/plugins/texteditor/textindenter.cpp index 53801fabfa..3dab3e2c48 100644 --- a/src/plugins/texteditor/textindenter.cpp +++ b/src/plugins/texteditor/textindenter.cpp @@ -37,7 +37,8 @@ TextIndenter::TextIndenter(QTextDocument *doc) TextIndenter::~TextIndenter() = default; IndentationForBlock TextIndenter::indentationForBlocks(const QVector<QTextBlock> &blocks, - const TabSettings &tabSettings) + const TabSettings &tabSettings, + int /*cursorPositionInEditor*/) { IndentationForBlock ret; for (QTextBlock block : blocks) @@ -47,7 +48,8 @@ IndentationForBlock TextIndenter::indentationForBlocks(const QVector<QTextBlock> void TextIndenter::indentBlock(const QTextBlock &block, const QChar &typedChar, - const TabSettings &tabSettings) + const TabSettings &tabSettings, + int /*cursorPositionInEditor*/) { Q_UNUSED(typedChar); const int indent = indentFor(block, tabSettings); @@ -58,7 +60,8 @@ void TextIndenter::indentBlock(const QTextBlock &block, void TextIndenter::indent(const QTextCursor &cursor, const QChar &typedChar, - const TabSettings &tabSettings) + const TabSettings &tabSettings, + int /*cursorPositionInEditor*/) { if (cursor.hasSelection()) { QTextBlock block = m_doc->findBlock(cursor.selectionStart()); @@ -72,7 +75,9 @@ void TextIndenter::indent(const QTextCursor &cursor, } } -void TextIndenter::reindent(const QTextCursor &cursor, const TabSettings &tabSettings) +void TextIndenter::reindent(const QTextCursor &cursor, + const TabSettings &tabSettings, + int /*cursorPositionInEditor*/) { if (cursor.hasSelection()) { QTextBlock block = m_doc->findBlock(cursor.selectionStart()); |