Copy/paste in tree controls highlights wrong entry

Posted by Kahenraz on Wed 21 Sep 2016 01:28 AM — 8 posts, 31,262 views.

#0
I reported this a while ago but just realized that I submitted it to the wrong board.

http://www.gammon.com.au/forum/?id=13779

Confirmed that it still occurs in 5.02.

An easy way to test is to create a new world. Make a trigger for "a", "b", "c" then highlight "b" and copy/paste. You will see that the tree view highlights "c" (the last edited entry) and not the copy of "b" as expected.
Australia Forum Administrator #1
When I tried it the first "b" remained selected. (That was the selection, and it still is).
Amended on Wed 21 Sep 2016 02:39 AM by Nick Gammon
#2
I tested on Windows 10 x64 using the following 5.02 client:

http://www.gammon.com.au/files/mushclient/mushclient502.exe

This behavior also exists in the current 4.94 stable client.

Can you confirm on the stable and the 5.02 client I tested with? Maybe you're using a different version than I am?
Australia Forum Administrator #3
I used 5.02
#4
But is your build different than the one I linked?

This has been an ongoing issue for me in 4.94. Can you confirm if you have this issue in that version? I don't see why we should be getting different results.
Amended on Wed 21 Sep 2016 03:40 AM by Kahenraz
Australia Forum Administrator #5
OK, I've worked it out. If you select "b", and then close the trigger list dialog, and then re-open it, and then copy and paste "b", the first "b" will be selected (it doesn't really matter which one, since they are identical).

The code to remember the current selection was not called when doing a paste, which is why some other item (previously selected when you closed the trigger list) was re-selected.

I don't think it is practical to select the new item because you can copy/paste multiple items (eg. from the list or from the forum) - and the tree view doesn't support multiple selections.

Re-selecting the last selected item is about as useful as I can make it without major changes.

https://github.com/nickgammon/mushclient/commit/a241059
#6
That sounds fine. Since the thing you're pasting will be a copy of the original then leaving the original selected will be just as good.

Thanks for fixing this. It's been one of my biggest pet peeves for a while now.

When do you think that we'll be seeing a new build?
Australia Forum Administrator #7
Soon.