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

Fix `gp` when pasting more than three lines #4247

Merged
merged 4 commits into from Nov 9, 2019

Conversation

@trkoch
Copy link
Contributor

trkoch commented Nov 5, 2019

What this PR does / why we need it:
Make gp (and gP) correctly place cursor after pasting 4+ lines.

Which issue(s) this PR fixes:
#4246

Special notes for your reviewer:
This looks to me like a minor slip of the original author. Tests did not reveal the bug and it is not super obvious in day to day usage.

Respect added lines count when creating new PositionDiff.

Fixes #4246.
@trkoch

This comment has been minimized.

Copy link
Contributor Author

trkoch commented Nov 5, 2019

Turns out this only works as expected in simple cases, but still has issues when there is existing text after paste (i.e. paste in the middle of a file). Specifically, the cursor is two lines below the expected line. Mind you it is broken in both master and this PR. What's happening? 🤷‍♂

@trkoch

This comment has been minimized.

Copy link
Contributor Author

trkoch commented Nov 5, 2019

I simplified and removed the obscure (to me) addAnotherLine switch. Also expanded the fix to gP. Judging from some quick testing this seems to work as expected now. I'll continue testing in my local installation.

Copy link
Collaborator

J-Fields left a comment

LGTM. Thanks!

@J-Fields J-Fields merged commit 5d067f4 into VSCodeVim:master Nov 9, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.