summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2014-03-22 20:24:55 +0200
committerOrgad Shaneh <orgads@gmail.com>2014-03-26 09:56:09 +0100
commit31cad45c0e6d846cce55500f2af8e7c67c6ab7c9 (patch)
treeb3e9f01a7106fcf0c35ec8975babf8b37447864e
parentdcd71423d25baab4c797098a0363c51ea164e99f (diff)
downloadqt-creator-31cad45c0e6d846cce55500f2af8e7c67c6ab7c9.tar.gz
TextEditor: Fix handling of multiline text for code assistant
Task-number: QTCREATORBUG-8544 Change-Id: Ic0cffe941309ee38cc62111960c5ddad46025a8c Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
-rw-r--r--src/plugins/texteditor/convenience.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/texteditor/convenience.cpp b/src/plugins/texteditor/convenience.cpp
index a3b4ac4dc8..b6797be71c 100644
--- a/src/plugins/texteditor/convenience.cpp
+++ b/src/plugins/texteditor/convenience.cpp
@@ -61,7 +61,8 @@ QString textAt(QTextCursor tc, int pos, int length)
tc.setPosition(pos);
tc.setPosition(pos + length, QTextCursor::KeepAnchor);
- return tc.selectedText();
+ // selectedText() returns U+2029 (PARAGRAPH SEPARATOR) instead of newline
+ return tc.selectedText().replace(QChar::ParagraphSeparator, QLatin1Char('\n'));
}
} // Util