-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make multi-select Copy/Paste behaviour as same as column edit's one #14338
Make multi-select Copy/Paste behaviour as same as column edit's one #14338
Conversation
Copy some multi-select texts and paste them make all text glued all together. This commit makes pasted texts separated by EOL, as column selection's Copy/Paste behaviour. Ref: notepad-plus-plus#14266 (comment)
@Ekopalypse @vinsworldcom |
I adds the newlines, but not quite as expected:
With the cursor at position 0 (to the left of the
Outcome:
Expected (and what happens in BetterMultiSelection):
Cheers. |
@vinsworldcom |
Better, but still not quite. Doing the same test above, the output it:
Seems as though the paste starts from the "main" caret and then continues in a column down vs. inserting at each word at the respective multi-caret location it was cut from to the present location of that respective multi-caret. Cheers. |
Select Result:
Expected:
|
I would not expect that. You're copying Text2 which is under Text1
visually, thus when pasted I would expect it to appear the same..
I'm pretty sure if you use better multi-selection you will get the results
I describe.
If we can't agree on how to implement this feature pasting, I will just
continue to use better multi-select to get the results I expect.
Happy either way..
Cheers.
…On Wed, Nov 8, 2023, 6:52 PM Yaron10 ***@***.***> wrote:
Test1
Test2
Select Test1.
Press Ctrl and select Test2.
Copy.
Add a new line.
Paste.
*Result:*
Test1
Test2
*Expected:*
Test1Test2
—
Reply to this email directly, view it on GitHub
<#14338 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJVWUO2PND7YUDQTWMENATYDQLLJAVCNFSM6AAAAAA7DPCNTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBSHEZDOOJSGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Try it with
|
@Yaron10 |
@vinsworldcom
and it works as expected. However, I use rarely the multi-edit with keyboard on Visual Studio. Could you check the latest commit and give me a feedback for the necessary enhancement to this PR? |
@donho for the few quick tests I did, selecting from top-down, bottum-up, partial, whole-word, navigation with arrow-key and I'm sure an immense amount of work dealing with corner cases - so thank you for your dedication to getting this done! I'm going to remove BetterMultiSelection for the next few days while going through my normal editing and use of N++. I'll see if anything pops up. Cheers. |
The current master behavior can be useful in many cases. If a doc is read-only, the flag is removed after Ctrl+V. Following @vinsworldcom STR in #14338 (comment). Ctrl+V:
(Undo is disabled). Edit -> Paste:
|
I thought Shift should be pressed. Edit -> Paste:
|
@Yaron10
Fixed in the latest commit.
In the perfect world it should work also with Ctrl-V, but in real life ppl just don't use the the Paste on the menu item. |
I usually use Paste in the context menu. Thank you for your time and effort. Undo is disabled after Ctrl+V.
Use ALT+SHIFT+Down to extend caret to the f in four. Why should the result in the first three lines be different? - The main caret and additional carets are in the same positions as in @vinsworldcom's case. |
@Yaron10 , if I do your latest test case in the latest commit artifact and in N++ with BetterMultiSelection, I get the same results - so at least behavior is consistent - if not ideal. Cheers. |
In BetterMultiSelection & this PR current state, concerning behaviour is the same - it ensures both number of source (occurrences to paste in clipboard) and number of targets (multi-selection) are the same to do this operation. @Yaron10 & @vinsworldcom Such behaviour can be changed - what's your preferred behaviour then? |
The current behaviour is consistent with what I would expect - though I've been user BetterMultiSelection for years now so my view of behaviour is probably skewed to the way that plugin operates vs. what new possibilities could be. I generally don't do the thing @Yaron10 posits above - manually clicking the paste-to locations in a different order expecting they would appear in that new order and perhaps repeat if more paste-to locations are selected than objects copied. I don't really have a guess as to how this should behave since I've never really had a use case for it. With respect, I will caution that looking at these corner cases and creating an interpretation for them will surely be "incorrect" in at least someone else's opinion so not sure how far down the added implementation road you want to go? Cheers. |
As opposed to @vinsworldcom, I rarely use multiple-selections in real life. |
Thank you for fixing the Undo issue. |
Let me say one more thing about this:
@yaron noted:
Let's try to remember going forward that users have different ways of doing things. With configurable editor-context menu, configurable tab-right-click menu, mapped-keycombos, or just plain using something on the "main menu", ALL are equally valid ways to do something, and user picks which is best for himself. These things should all in the end execute the same code, no matter how invoked. I'm not sure how "paste" ever became different depending upon how invoked... I recently took care of the strangeness with Line Duplicate... All of these are good steps. |
Sorry I'm late to the party, unfortunately I've been busy with other things all week. I also tested the PR and ran into 3 "problems" (?).
make a rectangular selection before 't' Now select a rectangular selection at the end of the line and press Enter. It should have the same behavior as the first test, but this is not the case. It just inserts a new line after test2 and also I can't use the backspace key anymore. If I move the cursor once to the left and then back to the right, before pressing enter, then it works as expected. Assume the following content for the second test
Select both The result should be
but the result is
The second test is very specific, so it's not really a problem for me, but it might be worth thinking about. Finally, assume the following code in python def test1():
pass
def test2():
pass Select both instances of |
Yikes! Can't believe I missed that one. Perhaps since I was using the default settings in a fresh portable install to test. I always have that setting enabled and you're right, it doesn't work as expected, but does with BetterMultiSelection plugin enabled. Cheers. |
Just to make sure, all three tests behave differently and in my opinion correctly with the BetterMultiSelection plugin. The first and second are rather ignorable for me, the last one is more of a problem for me as I use npp 99% of the time with the autoindent feature. |
Agree! |
Also disable auto-indent during multi-editing. Ref: notepad-plus-plus#14338 (comment)
PR #14355 has enhanced multi-edit paste and Enter key-in. Please check it to see if it's what you need. |
This is a non-starter for me. I always have auto-indent enabled and expect it to function during multi-caret editing - as it does today. Making it disabled during multi-caret editing breaks current capability and even with BetterMultiSelect, this will no longer work how it does today. I disabling auto-indent during multi-select as regressive. NOTE: If this cannot be done "natively" - no worries. But please don't "break" functionality (disable auto-indent during multi-select editing) which leave me little way to get around that limitation. I'm happy to continue to use a plugin to get the functionality I expect, but disabling auto-indent during multi-select editing renders even the plugin route unusable. Cheers. |
Also disable auto-indent during multi-editing. Ref: #14338 (comment) Close #14355
If I use the builds of 1764758 then the deletions at the beginning/end of lines are without effect: delete key on line end backspace on line start |
@CennoxX , indeed, I can confirm. With BetterMultiSelection, it does behave as expected - Delete at the end of the lines removes the "newline" and all the lines become one with multi-carets dispersed throughout continuing to delete as Same with Cheers. |
I have no solution yet. I know it's not perfect, but in the meanwhile, use Ctrl-DEL for deleting the EOL in multi-edit mode. |
Please check new commit in master: c517985. Edit: the code was committed and pushed into master in a church, by hoping that the code is blessed and no more f**king bug found in multi-edit feature. :) |
There seems to be some inconsistency in caret movement with multi carets. Use my previous example:
Highlight both "sub" and then press the down arrow key three times, to put the multi-carets on the lines with "test". They should both be at the same position in the line; however, they are not:
Where the pipe ( Cheers. |
@vinsworldcom |
My bad, I should have said both carets should be at the 3-spaces in position, since sticky caret is enabled by default and the carets start at 3 positions in from the left on the "sub" line as they are placed after the
Where the pipe (|) above shows where the carets end up for me when using BetterMultiSelection. This would be the case if using only a single caret - it would end up 3-spaces in due to sticky behavior. So with multi carets, they both should "obey" this rule. I think the behavior of BetterMultiSelection is correct and both carets should end up 3 spaces in on the "test" line like I show in this post. My previous post was incorrect and for that I apologize. Cheers. |
Strangely, I cannot make BetterMultiSelection work with my v8.5.8 (official release) - to select both |
I tried with both the latest artifact and the official 8.5.8 release - both with BetterMultiSelection - behave as described in my second post - with the carets being 3 spaces in on the "test" line after moving them down from the Note, you need to have multi-editing enabled: It is not on by default in the 8.5.8 64-bit portable. Cheers. |
@vinsworldcom
Just tested in SciTE v5.3.9 - it's the same behaviour as under current master of Notepad++. Let's wait for the answer from Neil for this issue. |
Copy some multi-select texts and paste them make all text glued all together. This commit makes pasted texts separated by EOL, as column selection's Copy/Paste behaviour.
Ref: #14266 (comment)