Skip to content

Commit

Permalink
Minor fix on replace's behaviour.
Browse files Browse the repository at this point in the history
  • Loading branch information
aioutecism committed Jan 3, 2016
1 parent b39b8a6 commit fd676a0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Actions/Replace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export class ActionReplace {
return Promise.resolve(false);
}

const characters = Array(args.n + 1).join(args.character);

let ranges = activeTextEditor.selections.map(selection => {
return new Range(selection.active, selection.active.translate(0, args.n));
});
Expand All @@ -40,7 +38,8 @@ export class ActionReplace {

return activeTextEditor.edit((editBuilder) => {
ranges.forEach(range => {
editBuilder.replace(range, characters);
let text = activeTextEditor.document.getText(range);
editBuilder.replace(range, text.replace(/[^\n]/g, args.character));
});
})
.then(ActionReveal.primaryCursor);
Expand Down

0 comments on commit fd676a0

Please sign in to comment.