From 5e449a80c448db05b49122f3a046e37056ee509d Mon Sep 17 00:00:00 2001 From: Erik Verbruggen <erik.verbruggen@nokia.com> Date: Fri, 19 Feb 2010 15:10:10 +0100 Subject: [PATCH] Fixed diagnostic underlining to take the location length into account. Done-with: Christian Kamm --- src/plugins/qmljseditor/qmljseditor.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 924c45d3513..021643535fc 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -1122,10 +1122,15 @@ static void appendExtraSelectionsForMessages( sel.cursor = c; sel.cursor.setPosition(c.position() + column - 1); - if (sel.cursor.atBlockEnd()) - sel.cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor); - else - sel.cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor); + + if (d.loc.length == 0) { + if (sel.cursor.atBlockEnd()) + sel.cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor); + else + sel.cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor); + } else { + sel.cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, d.loc.length); + } if (d.isWarning()) sel.format.setUnderlineColor(Qt::darkYellow); -- GitLab