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

Paste in visual mode does not replace last character #89

Open
jsmith opened this issue Nov 15, 2021 · 1 comment
Open

Paste in visual mode does not replace last character #89

jsmith opened this issue Nov 15, 2021 · 1 comment

Comments

@jsmith
Copy link

jsmith commented Nov 15, 2021

When pasting in visual mode, the last character in the selection (the character under the cursor) is not replaced. To reproduce, enter into visual mode, make a selection, press yank, make the same selection again, and then paste.

I tried to dig into this a bit and noticed that, when yanking, there is a one character offset added to either the head or the anchor (see makeCmSelection, L3116 to L3119). This doesn't happen when pasting. I came up with a naive solution by adding 1 to selectionEnd.ch after L2597:

var selectionEnd = selectedArea[1];

// Added the following two lines
selectionEnd.ch += 1;
cm.setSelection(selectionStart, selectionEnd)

var selectedText = cm.getSelection();

It would be great to get this behavior fixed so that it mimics vim :) Thanks so much!

@eavesjump
Copy link

Likely related: googlecolab/colabtools#2748

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

No branches or pull requests

2 participants