aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2010-11-15 15:32:46 +0100
committercon <qtc-committer@nokia.com>2010-11-16 10:08:51 +0100
commit3564feacce6fea7296294da5b424524a65bc5396 (patch)
treea652df8143fff9fa6f832c96d98033c910344575
parenta783a90f4de6079cfc9286790a03130206b7f5ed (diff)
Fix crash when computing the selection path.
Task-number: QTCREATORBUG-3097 Reviewed-by: con
-rw-r--r--src/plugins/texteditor/texteditoroverlay.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/texteditor/texteditoroverlay.cpp b/src/plugins/texteditor/texteditoroverlay.cpp
index 7ee11757cdf..45a5ddce6f5 100644
--- a/src/plugins/texteditor/texteditoroverlay.cpp
+++ b/src/plugins/texteditor/texteditoroverlay.cpp
@@ -166,10 +166,12 @@ QPainterPath TextEditorOverlay::createSelectionPath(const QTextCursor &begin, co
int beginChar = 0;
if (!inSelection) {
- beginChar = begin.positionInBlock();
- line = blockLayout->lineForTextPosition(beginChar);
+ if (block == begin.block()) {
+ beginChar = begin.positionInBlock();
+ line = blockLayout->lineForTextPosition(beginChar);
+ firstOrLastBlock = true;
+ }
inSelection = true;
- firstOrLastBlock = true;
} else {
// while (beginChar < block.length() && document->characterAt(block.position() + beginChar).isSpace())
// ++beginChar;