Skip to content

Commit

Permalink
Fix #2168: surround spacing bug
Browse files Browse the repository at this point in the history
In Vim, the commands `yw` and `yaw` will also yank any trailing
whitespace. However, during a surround command `ysaw`, we want to
exclude that whitespace to avoid an offset.
  • Loading branch information
westim committed Nov 22, 2017
1 parent 36725f1 commit 56371b6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/actions/plugins/surround.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,9 @@ export class CommandSurroundAddToReplacement extends BaseCommand {
let start = vimState.surround.range.start;
let stop = vimState.surround.range.stop;

stop = stop.getRight();
if (TextEditor.getCharAt(stop) !== ' ') {
stop = stop.getRight();
}

if (vimState.surround.isVisualLine) {
startReplace = startReplace + '\n';
Expand Down

0 comments on commit 56371b6

Please sign in to comment.