Wrapping entire line behaves other than surround.vim #5

Closed
cofi opened this Issue Jan 22, 2012 · 4 comments

Projects

None yet

4 participants

@cofi

I'm currently working on some patches, one would add a documentation.
I draw on the examples from surround.vim and there isyssb on this line:

 { Hello } world!

The expected would be

 ({ Hello } world!)

but it is (make emacs on the latest evil)

(
 { Hello } world!
   )

I'm not sure if the problem lies with evil's sentence (line?) text object or evil-surround but since I can only think of surround to reproduce this I'll submit it here.

@timcharper
Owner

Hmm, I'm not even sure where to begin with this one. It's probably a quirk in evil's text objects, since evil-surround uses them to find surround points.

@lyro

I had a quick look at surround's code. If I understand correctly, then yss calls surround-region with a motion generated by evil-line. evil-line is a linewise motion, thus the region passed surround-region has "beg" as the first character in the first line of that region and end as the first character after the newline character of the last selected region, so that the region matches exactly the selected lines.

surround-region seems to handle 'line type motions by putting the surrounding tags on a new line before and after the region. I think the best solution would be to handle line-wise motions for surrounding tags like (...) or [...] differently and not inserting newlines but the opening tag before the first non-blank on the first line and the closing tag behind the last non-blank on the last line.

@lyro lyro referenced this issue Nov 1, 2012
Merged

Fix issue #5 #17

@blaenk

This can be closed it seems.

@timcharper
Owner

Fixed with 8b2ca83

@timcharper timcharper closed this Feb 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment