Space is trimmed when replacing delimiter of string literal contains trailing space
Opened this issue · 0 comments
rhysd commented
When cursor is on 'f',
puts 'foo '
<Plug>(operator-surround-replace)a'"
will change above code to:
puts "foo"
Note that the line has one trailing space at the end of line. So 'foo '
is modified to "foo"
.
This occurs because replacing is implemented as a combination of deleting and appending a surround. It deletes the surrounding '
at first(foo
), and then appends surrounding "
next("foo"
). When appending the surround, the space is not counted as surrounding and only 'foo' is considered as target.