summaryrefslogtreecommitdiff
path: root/src/plugins/texteditor/texteditor.cpp
diff options
context:
space:
mode:
authorIvan Donchevskii <ivan.donchevskii@qt.io>2019-01-28 08:11:20 +0100
committerIvan Donchevskii <ivan.donchevskii@qt.io>2019-01-31 10:25:18 +0000
commit1dee275f58e9f9df2e2719325157cfdec42fe1cf (patch)
treeb5d3480d9484a9d0347de6d3d8219f31d70b602e /src/plugins/texteditor/texteditor.cpp
parent80fb0178fdd9ee82acfb22aa512c7514868e89d1 (diff)
downloadqt-creator-1dee275f58e9f9df2e2719325157cfdec42fe1cf.tar.gz
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/texteditor.cpp')
-rw-r--r--src/plugins/texteditor/texteditor.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index 7907259306..4e9de84f10 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -2491,7 +2491,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e)
--extraBlocks;
ensureVisible.movePosition(QTextCursor::NextBlock);
if (tps.m_autoIndent)
- d->m_document->autoIndent(ensureVisible);
+ d->m_document->autoIndent(ensureVisible, QChar::Null, cursorPosition);
else if (!previousIndentationString.isEmpty())
ensureVisible.insertText(previousIndentationString);
if (d->m_animateAutoComplete || d->m_highlightAutoComplete) {
@@ -2773,7 +2773,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e)
cursor.setPosition(pos, QTextCursor::KeepAnchor);
}
if (!electricChar.isNull() && d->m_autoCompleter->contextAllowsElectricCharacters(cursor))
- d->m_document->autoIndent(cursor, electricChar);
+ d->m_document->autoIndent(cursor, electricChar, cursor.position());
if (!autoText.isEmpty())
cursor.setPosition(autoText.length() == 1 ? cursor.position() : cursor.anchor());