Commit 2bc5c81a authored by Aurindam Jana's avatar Aurindam Jana
Browse files

ScriptConsole: Refactor extra selections code



Change-Id: I251dc5646bfcf1da386939bb8309b8db6cd2eeaa
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent c158ae13
......@@ -222,27 +222,21 @@ void QmlJSScriptConsole::appendResult(const QString &result)
QTextCursor cur = textCursor();
cur.movePosition(QTextCursor::End);
cur.insertText(_("\n"));
cur.insertText(result);
cur.movePosition(QTextCursor::EndOfLine);
cur.insertText(_("\n"));
setTextCursor(cur);
displayPrompt();
QTextEdit::ExtraSelection sel;
QTextCharFormat resultFormat;
resultFormat.setForeground(QBrush(QColor(Qt::darkGray)));
QTextCursor c(document()->findBlockByNumber(cur.blockNumber()-1));
c.movePosition(QTextCursor::StartOfBlock);
c.movePosition(QTextCursor::NextBlock, QTextCursor::KeepAnchor);
cur.movePosition(QTextCursor::PreviousBlock);
cur.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
sel.format = resultFormat;
sel.cursor = c;
sel.cursor = cur;
d->selections.append(sel);
setExtraSelections(d->selections);
displayPrompt();
}
void QmlJSScriptConsole::clear()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment