Implemented paste action#115
Implemented paste action#115pokey merged 2 commits intocursorless-dev:masterfrom AndreasArvidsson:paste
Conversation
pokey
left a comment
There was a problem hiding this comment.
Nice! Left a few minor comments. Also, you'll prob want to add the new delimiter insertion behaviour that I tacked onto the "move" PR so that you can say eg "paste after arg air" or "paste after line air" and it will do the right thing
| const lines = text.trim().split("\n"); | ||
|
|
||
| const getText = | ||
| targets.length === lines.length |
There was a problem hiding this comment.
I think we decided to match VSCode behaviour and check that number of lines is divisible by number of targets and if so split clipboard into blocks
There was a problem hiding this comment.
That's what line 37 does
There was a problem hiding this comment.
That checks equality, not divisibility, no? What am I missing?
There was a problem hiding this comment.
That is how vscode paste work. It only splits the clipboard if they are the same amount/length.
There was a problem hiding this comment.
Nope! Try it out. Copy 4 lines, then make 2 cursors and paste. It will split up the 4 lines into 2 blocks of 2
There was a problem hiding this comment.
Not on windows at least. I tried it multiple times before I made the implementation and I tried it once again now.
There was a problem hiding this comment.
Haha wait really? That's really odd that that would differ on platforms. I'll try it one more time today; maybe I messed something up in my testing
There was a problem hiding this comment.
Yes. Really strange if it differs.
|
Also, I don't think this code matches vscode's paste behaviour wrt trimming. But maybe let's file that as a follow-up issue. When we add tests for this action we can test that it matches VSCode on various edge cases |
|
What about the trimming is not correct? There is no trimming when broadcasting the clipboard. You mean that we should remove the trim before split? That is an easy fix. |
…dev#115) * Added identity modifier. Added head tail modifier to csv * Update src/modifiers/identity.py Co-authored-by: Pokey Rule <pokey.rule@gmail.com> * Update src/modifiers/modifiers.py Co-authored-by: Pokey Rule <pokey.rule@gmail.com> * Changed identifier on head tail * Update src/modifiers/identity.py Co-authored-by: Pokey Rule <pokey.rule@gmail.com>
Issue #36