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

Fixes #1441: Ctrl-c dropping a character when selecting from right to left in insert mode #1628

Merged
merged 2 commits into from
May 4, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1637,12 +1637,14 @@ class CommandOverrideCopy extends BaseCommand {
const start = Position.EarlierOf(range.start, range.stop);
const stop = Position.LaterOf(range.start, range.stop);

return vimState.editor.document.getText(new vscode.Range(
start,
vimState.currentMode === ModeName.Insert ?
stop :
stop.getRight()
));
// Insert selecting from the left to the right is a special case that
// selects one more on the right.
// The order of the if statements is to check for the case where start=stop
if (vimState.currentMode !== ModeName.Insert || start.isEqual(range.stop)) {
return vimState.editor.document.getText(new vscode.Range(start, stop.getRight()));
} else {
return vimState.editor.document.getText(new vscode.Range(start, stop));
}
}).join("\n");
} else if (vimState.currentMode === ModeName.VisualLine) {
text = vimState.allCursors.map(range => {
Expand Down