Open core-ai-bot opened 3 years ago
Comment by njx Monday Mar 17, 2014 at 10:22 GMT
I think this is because CM assumes that each copied selection is a single line, so if the number of copied lines doesn't match the number of selections, it pastes everything. I'm not sure if there's some more clever way it could store the information about multiple selections on the clipboard, since there really isn't any way for JS to put anything special on the clipboard - the only thing you can do is text.
Comment by wnr Monday Mar 17, 2014 at 10:34 GMT
Hmm, maybe I'm missing something here but CM does keep track somehow which text to copy to/from clipboard at which cursor, right? Then couldn't the logic that handles that, make sure that when there is a mismatch between number of current selections and copied selections mismatch, then only paste the previously primary selection (i.e. the last one).
Or how do we approach this problem? Clearly it needs to be solved since this is very confusing for users.
Comment by njx Monday Mar 17, 2014 at 11:14 GMT
Yes, sorry, I was referring to the main bug you filed (my conjecture is this is the reason why it doesn't properly match the pair of selections after your second set of steps). But we could make it so that if there's a mismatch, it only pastes the primary selection. However, I would note that Sublime has the same behavior as CM (if you select two items, then create a single cursor and paste, it pastes both items separated by a newline), so I'm inclined not to change that behavior since it seems to be expected.
Comment by wnr Monday Mar 17, 2014 at 11:29 GMT
Ah okay, then I understand :)
Yes, I noted the same in Sublime, I should've written that in the issue. However, the behaviour of Sublime is a bit different when you cut a line + a word. Then when you paste, it only pastes the primary selection (last one). So if you reproduce the problematic steps in Sublime, you will not get the same result as in brackets.
The last paragraph in the issue was only a personal opinion, but since Sublime does the same I understand we might wanna go with current behaviour (I'm gonna edit the issue to clarify). But still, the difference as explained above seems like a bug to me.
What do you think?
Comment by njx Monday Mar 17, 2014 at 11:40 GMT
That is interesting - I'll have to do a little more playing around to understand what the heuristics should be.
Comment by njx Monday Mar 17, 2014 at 15:10 GMT
@
wnr FYI, I just tried both these use cases in both Sublime 3 and Ace (line + word selected, copy, arrow right to keep two selections, paste; line + word selected, copy, set single cursor, paste) and got the same behavior as CM (both line and word pasted) in all cases. The only time I was able to get it to paste different content into each selection was when each selection was smaller than a line, and whenever I set a single selection it always concatenated all the copied content. So it looks like they're both using the same heuristics as CM.
Comment by wnr Monday Mar 17, 2014 at 20:52 GMT
Ah you're right! I think my confusion must have been that when you set a cursor on a line and then highlight a word and then copy, I expected it to behave the same way as if I would have selected the line containing the cursor. Instead, when only having a cursor + selected word, it seems to only copy the selected word. Since Ctrl-c with only a cursor copies the whole line, I expected these cases to be equivalent, which is not the case. My bad :)
Comment by njx Monday Mar 17, 2014 at 21:02 GMT
Got it. Given that, should we go ahead and close this one out?
Comment by njx Tuesday Mar 18, 2014 at 16:14 GMT
OK, thanks - definitely let us know if you have any other suggestions for multiple selection.
Issue by wnr Monday Mar 17, 2014 at 09:06 GMT Originally opened as https://github.com/adobe/brackets/issues/7211
The problem:
EDIT: Below is just a personal opinion and is not really the bug. Since Sublime doesn't behave as described below, I understand that we might skip my suggestion below. So the paragraph below can be skipped.
Also, I think that the copied selections never should be merged. Right now, if you have two selections and copy-paste, it would be the same behaviour as if i did each copy paste separately (which is cool). However, if doing copy with two selections and then one of the cursors is removed (so only one is left) then I think that a paste should result in only the previously primary selection should be pasted (not the merge of the two previously selections).