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

Putting over selection in visual mode does not yank deleted selection #1280

Closed
rhys-vdw opened this issue Feb 7, 2017 · 8 comments
Closed
Labels

Comments

@rhys-vdw
Copy link
Contributor

rhys-vdw commented Feb 7, 2017

Please thumbs-up 👍 this issue if it personally affects you! You can do this by clicking on the emoji-face on the top right of this post. Issues with more thumbs-up will be prioritized.


What did you do?

Attempted to swap two words by using cut/paste in visual mode:

|from to

Commands: dewvep0P

What did you expect to happen?

t|o from

What happened instead?

fro|m from

Technical details:

  • VSCode Version: 1.9.0
  • VsCodeVim Version: 0.5.2
  • OS: OSX
@rhys-vdw rhys-vdw changed the title Pasting over selection in visual mode does not copy deleted selection Putting over selection in visual mode does not yank deleted selection Feb 7, 2017
@rhys-vdw
Copy link
Contributor Author

rhys-vdw commented Feb 7, 2017

Tried to fix this myself by swapping the order of 'delete' and 'put' invocations, and enabling yank on delete, but it leaves the cursor in a bad position (at the start of pasted text instead of the end).

rhys-vdw@5a03cf2

Could somebody advise me how to achieve this idiomatically?

@xconverge
Copy link
Member

ah this is a good catch, yea at least it wasn't yanking when deleting over the previous register in current master

I think you are on the right track, can you just set vimState.cursorPosition = at the end?

I think this is happening because the delete is pushing a transform that sets the cursor position that is not quite right, not sure...

@rhys-vdw
Copy link
Contributor Author

rhys-vdw commented Feb 8, 2017

Just had another play around with this. I guess the problem is that I don't know what to set the cursor position to.

@rhys-vdw
Copy link
Contributor Author

rhys-vdw commented Feb 8, 2017

I'll try to revisit this in the coming days, I'm sure it will keep annoying me. :)

@xconverge
Copy link
Member

You can get the register length before doing anything?

@johnfn
Copy link
Member

johnfn commented Mar 2, 2017

@rhys-vdw, I'm sorry I missed your questions earlier. The most reliable way to bug me in the future is to ping me on Slack. I try to be fairly responsive. :)

@rhys-vdw
Copy link
Contributor Author

rhys-vdw commented Mar 2, 2017

Thanks @johnfn. I'm a bit busy to work on this PR for now.

@bschlenk
Copy link

+1 This prevents my usual way of swapping key/values in js objects.

rebornix pushed a commit to Chillee/Vim that referenced this issue May 5, 2017
xconverge added a commit that referenced this issue May 6, 2017
Fixes #1280: Pasting over selection doesn't yank deleted section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants