c-indent: Tweak implementation of c-family-insert-on-newline

This commit is contained in:
Maxime Coste 2016-08-05 09:37:25 +01:00
parent 19e36425f4
commit 967a55d09f

View File

@ -76,7 +76,7 @@ def -hidden _c-family-insert-on-closing-curly-brace %[
try %[ exec -itersel -draft hm<a-x>B<a-x><a-k>^\h*(class|struct|union)<ret> a\;<esc> ] try %[ exec -itersel -draft hm<a-x>B<a-x><a-k>^\h*(class|struct|union)<ret> a\;<esc> ]
] ]
def -hidden _c-family-insert-on-newline %[ def -hidden _c-family-insert-on-newline %[ eval -draft %[
exec \; exec \;
try %[ try %[
eval -draft %[ eval -draft %[
@ -92,11 +92,8 @@ def -hidden _c-family-insert-on-newline %[
] ]
] ]
try %[ try %[
eval -draft %[
## select the previous line ## select the previous line
exec k <a-x> exec k <a-x>
try %{
## if the previous line isn't within a comment scope, break ## if the previous line isn't within a comment scope, break
exec <a-k>^(\h*/\*|\h+\*[^/])<ret> exec <a-k>^(\h*/\*|\h+\*[^/])<ret>
## simple test to check that the previous comment has been left open ## simple test to check that the previous comment has been left open
@ -120,10 +117,8 @@ def -hidden _c-family-insert-on-newline %[
try %[ exec -draft 1s(\h+)$<ret>d ] try %[ exec -draft 1s(\h+)$<ret>d ]
## align the new star with the previous one ## align the new star with the previous one
exec J<a-x>1s^[^*]*(\*)<ret>& exec J<a-x>1s^[^*]*(\*)<ret>&
}
] ]
] ] ]
]
# Regions definition are the same between c++ and objective-c # Regions definition are the same between c++ and objective-c
%sh{ %sh{