From 5503bc6481f3d749e4dd503d4e53710657d37d5e Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Wed, 21 Jun 2017 10:58:28 -0400 Subject: Qt: display newlines in capture file comments Due to the use of HTML, whitespace (including newline) are shown as single horizontal space. Add a special case for newlines. Bug: 13819 Change-Id: Iefa2af7d2948ed18a3b7f8f4ee8cb90100bf3460 Reviewed-on: https://code.wireshark.org/review/22306 Petri-Dish: Anders Broman Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman (cherry picked from commit b44ad2a0fa58e4a5acb4293d047993b3aea1f532) Reviewed-on: https://code.wireshark.org/review/22311 Reviewed-by: Peter Wu --- ui/qt/capture_file_properties_dialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/qt/capture_file_properties_dialog.cpp b/ui/qt/capture_file_properties_dialog.cpp index dd53edfd32..1f18bdf6a1 100644 --- a/ui/qt/capture_file_properties_dialog.cpp +++ b/ui/qt/capture_file_properties_dialog.cpp @@ -516,7 +516,7 @@ void CaptureFilePropertiesDialog::fillDetails() if (!file_comments.isEmpty()) { QString file_comments_html; - QString comment_escaped = html_escape(file_comments); + QString comment_escaped = html_escape(file_comments).replace('\n', "
"); file_comments_html = section_tmpl_.arg(tr("File Comment")); file_comments_html += para_tmpl_.arg(comment_escaped); @@ -536,7 +536,7 @@ void CaptureFilePropertiesDialog::fillDetails() QString frame_comment_html = tr("

Frame %1: ").arg(framenum); QString raw_comment = pkt_comment; - frame_comment_html += html_escape(raw_comment); + frame_comment_html += html_escape(raw_comment).replace('\n', "
"); frame_comment_html += "

\n"; cursor.insertBlock(); cursor.insertHtml(frame_comment_html); -- cgit v1.2.1