Skip to content

Commit

Permalink
Merge pull request #2062 from DanEEStar/bugfix/selecting-insert-mode
Browse files Browse the repository at this point in the history
Bugfix #1951: text selection in insert mode
  • Loading branch information
xconverge authored Oct 11, 2017
2 parents 8da76ef + b20cd05 commit c11bf8f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/actions/commands/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -882,11 +882,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 ||
vimState.currentMode === ModeName.Insert
) {
if (vimState.currentMode === ModeName.Visual || vimState.currentMode === ModeName.Normal) {
text = vimState.allCursors
.map(range => {
const start = Position.EarlierOf(range.start, range.stop);
Expand Down Expand Up @@ -917,6 +913,12 @@ class CommandOverrideCopy extends BaseCommand {
for (const { line } of Position.IterateLine(vimState)) {
text += line + '\n';
}
} else if (vimState.currentMode === ModeName.Insert) {
text = vimState.editor.selections
.map(selection => {
return vimState.editor.document.getText(new vscode.Range(selection.start, selection.end));
})
.join('\n');
}

util.clipboardCopy(text);
Expand Down

0 comments on commit c11bf8f

Please sign in to comment.