Skip to content
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

Implemented paste action #115

Merged
merged 2 commits into from
Jul 21, 2021
Merged

Implemented paste action #115

merged 2 commits into from
Jul 21, 2021

Conversation

AndreasArvidsson
Copy link
Member

Issue #36

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what line 37 does

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That checks equality, not divisibility, no? What am I missing?

Copy link
Member Author

@AndreasArvidsson AndreasArvidsson Jul 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is how vscode paste work. It only splits the clipboard if they are the same amount/length.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

@AndreasArvidsson AndreasArvidsson Jul 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not on windows at least. I tried it multiple times before I made the implementation and I tried it once again now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Really strange if it differs.

src/actions/Paste.ts Show resolved Hide resolved
src/actions/Paste.ts Show resolved Hide resolved
@pokey
Copy link
Member

pokey commented Jul 15, 2021

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

@AndreasArvidsson
Copy link
Member Author

AndreasArvidsson commented Jul 15, 2021

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.

pokey
pokey previously approved these changes Jul 21, 2021
@pokey pokey merged commit 63b330a into cursorless-dev:master Jul 21, 2021
@AndreasArvidsson AndreasArvidsson deleted the paste branch July 21, 2021 07:08
thetomcraig-aya pushed a commit to thetomcraig/cursorless that referenced this pull request Mar 27, 2024
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants