From 9d118e5302db0c9aefe6b0e662795aef6f7b71a1 Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Mon, 25 May 2015 06:28:32 +0200 Subject: [PATCH] Fix formating of comments. Should not start with a linebreak When displaying a comment, an additional linebreak was inserted right after the ";;" mark and before the first comment. This linebreak is removed here. --- src/gui/widgets/BasicBlockWidget.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/BasicBlockWidget.cxx b/src/gui/widgets/BasicBlockWidget.cxx index 1cdc33f..2a3f3b7 100644 --- a/src/gui/widgets/BasicBlockWidget.cxx +++ b/src/gui/widgets/BasicBlockWidget.cxx @@ -261,12 +261,11 @@ void BasicBlockWidget::populateWidget() { } QString BasicBlockWidget::formatComments(Instruction* inst) { - QString comments; + QStringList comments; for (Comment* c: inst->comments()) { - comments += "
"; - comments += QString(c->getText().c_str()).toHtmlEscaped(); + comments << QString(c->getText().c_str()).toHtmlEscaped(); } - return (comments == "" ? "" : ";; ") + comments.trimmed(); + return (comments.empty() ? "" : ";; ") + comments.join("
").trimmed(); } void BasicBlockWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem*, -- 2.39.5