From 309bf5b5476a853eb4e0635a1355872246e97b18 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 19 Nov 2019 18:23:38 -0800 Subject: [PATCH] Make sure Copy > As Text and Copy > As CSV add a final newline. Bug: 16214 Change-Id: Idb691c1fbb33b2fabca5726c159b1f754668c1ae Reviewed-on: https://code.wireshark.org/review/35147 Petri-Dish: Guy Harris Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris --- ui/qt/main_window_slots.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 751653be01..71c137eb90 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -1966,8 +1966,20 @@ void MainWindow::actionEditCopyTriggered(MainWindow::CopySelected selection_type content << entry; } - if (content.count() > 0) + if (content.count() > 0) { clip = content.join("\n"); + // + // Each YAML item ends with a newline, so the string + // ends with a newline already if it's CopyListAsYAML. + // If we add a newline, there'd be an extra blank + // line. + // + // Otherwise, we've used newlines as separators, not + // terminators, so there's no final newline. Add it. + // + if (selection_type != CopyListAsYAML) + clip += "\n"; + } } break; }