emacs-evil / evil-surround

you will be surrounded (surround.vim for evil, the extensible vi layer)
Other
627 stars 60 forks source link

Open curly bracket after a compound statement #142

Closed duianto closed 5 years ago

duianto commented 5 years ago

Observed behavior

An open curly bracket after a compound statement causes an issue when the brackets are deleted.

Before:

if (condition) {
    true
}

if condition {
    true
}

With the cursor on the word true

Press: dsB or ds}

After:

if (condition)     true

if condition     true

The true line ends up where the open curly bracket was, and it still has the leading whitespace.

Expected behavior

if (condition)
    true

if condition
    true

System information

evil-surround 20180102.1401
Evil version 1.2.13
GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30
Windows 10 Version 1803
ninrod commented 5 years ago

Yeah, I concur that this is strange, but it respects the same behaviour as vim-surround, which we follow.

duianto commented 5 years ago

There's an open issue about it on the vim-surround repository: Issue dsB #223

I commented there as well, so maybe it will be fixed "upstream", or someone might have an explanation as to why it works that way.

qstrahl mentions there, that ds{ deletes the leading whitespace, and that also works with evil-surround.

The vim issues with the horstmann brace placement style, does not happen with evil-surround.

ninrod commented 5 years ago

all right, let's keep an eye on it.