aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2017-07-17 14:32:59 +0200
committerOrgad Shaneh <orgads@gmail.com>2017-07-18 21:14:35 +0000
commit1ebc364349bbae3f22ea7e3d96adaa81fb5411eb (patch)
tree4fb37a54c28785187c85df085aa096685848dd73
parent66f762959eb24bd8fc6ac92ef73203b7af108182 (diff)
TextEditor: Jump over braces inserted by the TextDocumentManipulatorv4.4.0-beta1
Task-number: QTCREATORBUG-16946 Change-Id: I445c5698da59230f1d6ae859e6bbf20d26fc5bb9 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
-rw-r--r--src/plugins/texteditor/texteditor.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index 7e8c1c2345..ba1dd248bd 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -7431,7 +7431,10 @@ void TextEditorWidget::keepAutoCompletionHighlight(bool keepHighlight)
void TextEditorWidget::setAutoCompleteSkipPosition(const QTextCursor &cursor)
{
QTextCursor tc = cursor;
- tc.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
+ // Create a selection of the next character but keep the current position, otherwise
+ // the cursor would be removed from the list of automatically inserted text positions
+ tc.movePosition(QTextCursor::NextCharacter);
+ tc.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor);
d->autocompleterHighlight(tc);
}