Skip to content

Commit

Permalink
Use native selections instead of ranges in normal mode. (#3712)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroton authored and jpoon committed Apr 30, 2019
1 parent 4b3d59f commit 8c75999
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/actions/commands/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ class CommandOverrideCopy extends BaseCommand {
public async exec(position: Position, vimState: VimState): Promise<VimState> {
let text = '';

if (vimState.currentMode === ModeName.Visual || vimState.currentMode === ModeName.Normal) {
if (vimState.currentMode === ModeName.Visual) {
text = vimState.cursors
.map(range => {
const start = Position.EarlierOf(range.start, range.stop);
Expand All @@ -1050,7 +1050,10 @@ class CommandOverrideCopy extends BaseCommand {
for (const { line } of Position.IterateLine(vimState)) {
text += line + '\n';
}
} else if (vimState.currentMode === ModeName.Insert) {
} else if (
vimState.currentMode === ModeName.Insert ||
vimState.currentMode === ModeName.Normal
) {
text = vimState.editor.selections
.map(selection => {
return vimState.editor.document.getText(new vscode.Range(selection.start, selection.end));
Expand Down

0 comments on commit 8c75999

Please sign in to comment.