From 3564feacce6fea7296294da5b424524a65bc5396 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 15 Nov 2010 15:32:46 +0100 Subject: [PATCH] Fix crash when computing the selection path. Task-number: QTCREATORBUG-3097 Reviewed-by: con --- src/plugins/texteditor/texteditoroverlay.cpp | 8 +++++--- 1 file 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;