diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2010-11-15 15:32:46 +0100 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2010-11-16 10:08:51 +0100 |
commit | 3564feacce6fea7296294da5b424524a65bc5396 (patch) | |
tree | a652df8143fff9fa6f832c96d98033c910344575 /src/plugins | |
parent | a783a90f4de6079cfc9286790a03130206b7f5ed (diff) | |
download | qt-creator-3564feacce6fea7296294da5b424524a65bc5396.tar.gz |
Fix crash when computing the selection path.
Task-number: QTCREATORBUG-3097
Reviewed-by: con
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/texteditor/texteditoroverlay.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/texteditor/texteditoroverlay.cpp b/src/plugins/texteditor/texteditoroverlay.cpp index 7ee11757cd..45a5ddce6f 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; |