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

[Fixed] Reverse selection in normal mode #3124

Closed
wants to merge 3 commits into from
Closed
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
6 changes: 4 additions & 2 deletions src/actions/commands/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1010,8 +1010,10 @@ class CommandOverrideCopy extends BaseCommand {
.map(range => {
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, stop.getRight()));
})
return start < stop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs for EarlierOf state:

 /**
   * Returns which of the 2 provided Positions comes earlier in the document.
   */

so start should always be >= stop.

What's the case when start < stop?

? vimState.editor.document.getText(new vscode.Range(start, stop.getRight()))
: vimState.editor.document.getText(new vscode.Range(stop, start.getRight()))
})
.join('\n');
} else if (vimState.currentMode === ModeName.VisualLine) {
text = vimState.allCursors
Expand Down