From: Tuukka Lehtonen Date: Mon, 4 Nov 2019 14:12:08 +0000 (+0200) Subject: Removed trailing newline from clipboard text X-Git-Tag: v1.43.0~136^2~36 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F46%2F3446%2F1;p=simantics%2Fplatform.git Removed trailing newline from clipboard text When copying text to clipboard from GraphExplorer-based UI controls (Model Browser, Selection view) using StandardCopyHandler, the produced text no longer contains a trailing newline. gitlab #411 Change-Id: If4141b00ed9ffc1d1dcaed53114405e8b0d20042 (cherry picked from commit 17046fccd0b4bdcd479aadf4b204c1a06a2c896c) --- diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/StandardCopyHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/StandardCopyHandler.java index 05a698a13..e0c57a3d1 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/StandardCopyHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/StandardCopyHandler.java @@ -193,21 +193,23 @@ public class StandardCopyHandler extends AbstractHandler { Set items = new THashSet(selection.length); for (TreeItem item : selection) items.add(item); + boolean firstRow = true; for (TreeItem item : selection) { + if (!firstRow) + sb.append('\n'); + firstRow = false; int cc = item.getParent().getColumnCount(); int indent = indentLevel(item, items); for (int i = 0; i < indent; ++i) sb.append('\t'); - boolean first = true; + boolean firstColumn = true; for (int c = 0; c < cc; ++c) { String ct = item.getText(c); - if (!first) { + if (!firstColumn) sb.append('\t'); - } - first = false; + firstColumn = false; sb.append(ct); } - sb.append('\n'); } return sb; }