From 8c9a97479a58447f5f94526390d14641181ed2dd Mon Sep 17 00:00:00 2001 From: mae <qt-info@nokia.com> Date: Tue, 18 May 2010 16:00:42 +0200 Subject: [PATCH] Small fixes for vertical block selection The find scope was sometimes painted incorrectly, and the last line was occassionally ommited from the standard selection paint. Reviewed-by: thorbjorn --- src/plugins/texteditor/basetexteditor.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 61e50d3f7b1..8ed17087ec9 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -2361,11 +2361,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e) TextEditorOverlay *overlay = new TextEditorOverlay(this); overlay->addOverlaySelection(d->m_findScopeStart.position(), - d->m_findScopeVerticalBlockSelection ? - d->m_findScopeEnd.block().position() - + d->m_findScopeVerticalBlockSelection - + d->m_findScopeStart.positionInBlock() + 1 - : d->m_findScopeEnd.position(), + d->m_findScopeEnd.position(), d->m_searchScopeFormat.background().color().darker(120), d->m_searchScopeFormat.background().color(), TextEditorOverlay::ExpandBegin, @@ -2470,8 +2466,9 @@ void BaseTextEditor::paintEvent(QPaintEvent *e) const QAbstractTextDocumentLayout::Selection &range = context.selections.at(i); const int selStart = range.cursor.selectionStart() - blpos; const int selEnd = range.cursor.selectionEnd() - blpos; - if (selStart < bllen && selEnd > 0 - && selEnd > selStart) { + if (selStart <= bllen && selEnd >= 0 + && selEnd >= selStart + && !range.format.hasProperty(QTextFormat::FullWidthSelection)) { QTextLayout::FormatRange o; o.start = selStart; o.length = selEnd - selStart; -- GitLab