Skip to content

Commit

Permalink
Fixed new <D-d> insert issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Chillee committed May 25, 2017
1 parent 08370cf commit 18f0e89
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/actions/commands/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3148,10 +3148,18 @@ class ActionOverrideCmdD extends BaseCommand {
// determine where to add a word, we need to do a hack and manually set the
// selections to the word boundaries before we make the api call.
vscode.window.activeTextEditor!.selections =
vscode.window.activeTextEditor!.selections.map(x => {
vscode.window.activeTextEditor!.selections.map((x, idx) => {
const curPos = Position.FromVSCodePosition(x.active);
return new vscode.Selection(curPos.getWordLeft(true),
curPos.getLeft().getCurrentWordEnd(true).getRight());
if (idx === 0) {
return new vscode.Selection(curPos.getWordLeft(false),
curPos.getLeft().getCurrentWordEnd(true).getRight());
} else {
const matchWordPos = Position.FromVSCodePosition(vscode.window.activeTextEditor!.selections[0].active);
const matchWordLength = matchWordPos.getLeft().getCurrentWordEnd(true).getRight().character -
matchWordPos.getWordLeft(false).character;
const wordBegin = curPos.getLeftByCount(matchWordLength);
return new vscode.Selection(wordBegin, curPos);
}
});
await vscode.commands.executeCommand('editor.action.addSelectionToNextFindMatch');
vimState.allCursors = await allowVSCodeToPropagateCursorUpdatesAndReturnThem();
Expand Down

0 comments on commit 18f0e89

Please sign in to comment.