Skip to content

Commit

Permalink
Merge pull request #2036 from westim/visual-multicursor
Browse files Browse the repository at this point in the history
Fix for issue #1860, visual multicursor movement.
  • Loading branch information
xconverge authored Sep 27, 2017
2 parents 1ef93e9 + d5b3d9b commit ad19462
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,15 @@ export class ModeHandler implements vscode.Disposable {
) {
// Number of selections changed, make sure we know about all of them still
this.vimState.allCursors = e.textEditor.selections.map(
x => new Range(Position.FromVSCodePosition(x.start), Position.FromVSCodePosition(x.end))
sel =>
new Range(
// Adjust the cursor positions because cursors & selections don't match exactly
sel.anchor.compareTo(sel.active) > 0
? Position.FromVSCodePosition(sel.anchor).getLeft()
: Position.FromVSCodePosition(sel.anchor),
Position.FromVSCodePosition(sel.active)
)
);

await this.updateView(this.vimState);

return;
Expand Down

0 comments on commit ad19462

Please sign in to comment.