Skip to content

Space is trimmed when replacing delimiter of string literal contains trailing space #33

@rhysd

Description

@rhysd

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions