#21324 closed defect (fixed)
[PATCH] Command stack says "pasting 1 tag to [number] objects" regardless of how many tags are pasted
Reported by: | tguen | Owned by: | team |
---|---|---|---|
Priority: | minor | Milestone: | 22.12 |
Component: | Core | Version: | tested |
Keywords: | command stack paste | Cc: |
Description (last modified by )
What steps will reproduce the problem?
- Copy multiple tags
- Select an object
- ctrl+v
What is the expected result?
Command stack section of sidebar should correctly count the number of tags being pasted
What happens instead?
It always says "pasting 1 tag"
Please provide any additional information below. Attach a screenshot if possible.
Relative:URL: ^/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2021-08-02 19:44:04 +0200 (Mon, 02 Aug 2021) Revision:18118 Build-Date:2021-08-02 18:26:20 URL:https://josm.openstreetmap.de/svn/trunk Identification: JOSM/1.5 (18118 en) Linux Arch Linux Memory Usage: 320 MB / 3984 MB (96 MB allocated, but free) Java version: 16.0.2+7, N/A, OpenJDK 64-Bit Server VM Look and Feel: com.formdev.flatlaf.FlatDarkLaf Screen: :0.0 2560×1440 (scaling 1.00×1.00) Maximum Screen Size: 2560×1440 Best cursor sizes: 16×16→16×16, 32×32→32×32 Environment variable LANG: en_US.UTF-8 System property file.encoding: ANSI_X3.4-1968 System property sun.jnu.encoding: ANSI_X3.4-1968 Locale info: en_US Numbers with default locale: 1234567890 -> 1234567890 Desktop environment: KDE VM arguments: [-Djosm.restart=true, -Dawt.useSystemAAFontSettings=on] Program arguments: [/aux/osm/portland.jos] Dataset consistency test: No problems found Plugins: + apache-commons (35524) + apache-http (35589) + buildings_tools (35756) + ejml (35458) + flatlaf (35799) + geotools (35458) + jaxb (35543) + jna (35662) + jts (35458) + mapwithai (1.8.4) + opendata (35803) + reverter (35732) + terracer (35640) + undelete (35640) + utilsplugin2 (35792) Map paint styles: - https://josm.openstreetmap.de/josmfile?page=Styles/Admin_Boundaries&zip=1 + https://josm.openstreetmap.de/josmfile?page=Styles/iD&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1 + https://josm.openstreetmap.de/josmfile?page=Styles/MapWithAI&zip=1 Last errors/warnings: - 00006.260 E: Failed to locate image 'MapWithAI' - 00008.586 E: Unsupported savable layer type: TMSLayer - 00008.606 E: Unsupported savable layer type: TMSLayer - 00008.612 E: Unsupported savable layer type: TMSLayer
Attachments (0)
Change History (8)
comment:1 by , 4 years ago
Description: | modified (diff) |
---|
comment:2 by , 4 years ago
comment:3 by , 4 years ago
Keywords: | command stack paste added |
---|---|
Priority: | trivial → minor |
Version: | → latest |
comment:4 by , 4 years ago
Version: | latest → tested |
---|
Actually, it depends from where the tags are copied.
- If copied from mapview and "Paste Tags" is used everything is fine with the correct number of tags and each listed individually
- If copied from Tags/Memberships panel both action "Paste" and "Paste Tags" display the wrong number of tags and the tags are not listed but the lower level once unfolded does only have one entry with the correct numbers.
Best would be if in both cases lead to the identical outcome.
I went back til r15810 without any change of behavior.
comment:5 by , 2 years ago
Milestone: | → 22.12 |
---|---|
Summary: | Command stack says "pasting 1 tag to [number] objects" regardless of how many tags are pasted → [PATCH] Command stack says "pasting 1 tag to [number] objects" regardless of how many tags are pasted |
Once I actually debugged this, it was fairly simple. We are just counting the commands that are done, and one code path makes one command per tag while the other makes one command for all the tags.
I don't know why one of the code paths is making one command per tag. The revision log wasn't very helpful. :(
-
src/org/openstreetmap/josm/gui/datatransfer/importers/AbstractTagPaster.java
diff --git a/src/org/openstreetmap/josm/gui/datatransfer/importers/AbstractTagPaster.java b/src/org/openstreetmap/josm/gui/datatransfer/importers/AbstractTagPaster.java
a b 22 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 23 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 24 24 import org.openstreetmap.josm.tools.I18n; 25 import org.openstreetmap.josm.tools.Utils; 25 26 26 27 /** 27 28 * This transfer support allows us to transfer tags to the selected primitives … … 61 62 */ 62 63 protected static void commitCommands(Collection<? extends OsmPrimitive> selection, List<Command> commands) { 63 64 if (!commands.isEmpty()) { 64 String title1 = trn("Pasting {0} tag", "Pasting {0} tags", commands.size(), commands.size()); 65 int changedTags = Utils.filteredCollection(commands, ChangePropertyCommand.class).stream().mapToInt(p -> p.getTags().size()).sum(); 66 changedTags = changedTags > 0 ? changedTags : commands.size(); 67 String title1 = trn("Pasting {0} tag", "Pasting {0} tags", changedTags, changedTags); 65 68 String title2 = trn("to {0} object", "to {0} objects", selection.size(), selection.size()); 66 69 @I18n.QuirkyPluralString 67 70 final String title = title1 + ' ' + title2;
comment:7 by , 2 years ago
Milestone: | 22.12 → 22.11 |
---|
Ok, I can reproduce, if I:
Ctrl+V
)If I use "paste tags" (
Ctrl+Shift+V
) it works as expected.