QSGTextEdit::selectionEnd() interprets the selection end as the
first character after the selection, while QSGTextNode expects it
to be the end of the selection.
Task-number: QTBUG-21533
Change-Id: Ia928602f8a2f845f3990a443e62f640ea72aa1d4
Reviewed-on: http://codereview.qt-project.org/5363
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
QColor selectedTextColor = d->control->palette().color(QPalette::HighlightedText);
node->addTextDocument(bounds.topLeft(), d->document, d->color, QSGText::Normal, QColor(),
selectionColor, selectedTextColor, selectionStart(),
- selectionEnd());
+ selectionEnd() - 1);
#if defined(Q_WS_MAC)
// We also need to make sure the document layout is redone when
bool hasSelection = selectionStart >= 0
&& selectionEnd >= 0
- && selectionStart != selectionEnd;
+ && selectionStart <= selectionEnd;
QTextLine &line = m_currentLine;
int rangeEnd = rangeStart + rangeLength;