Fix corner case in C family indenting
This commit is contained in:
parent
98627726cf
commit
e73cd78288
|
@ -49,9 +49,9 @@ def -hidden c-family-indent-on-newline %< eval -draft -itersel %<
|
|||
# on a previous line if its followed by text on the same line
|
||||
try %< eval -draft %<
|
||||
# Go to opening parenthesis and opening brace, then select the most nested one
|
||||
try %< exec [bZ<a-\;>[B<a-z><gt> > catch %< exec [B >
|
||||
try %< try %< exec [bZ<a-\;>[B<a-z><gt> > catch %< exec [B > >
|
||||
# Validate selection and get first and last char
|
||||
exec <a-k>\`[{(](\h*\S+)+\n<ret> L s\`|.\'<ret>
|
||||
exec <a-k>\`[{(](\h*\S+)+\n<ret> <a-:><a-\;>L s\`|.\'<ret>
|
||||
# Remove eventual indent from new line
|
||||
try %< exec -draft <space> <a-h> s\h+<ret> d >
|
||||
# Now align that new line with the opening parenthesis/brace
|
||||
|
|
1
test/indent/c-family/align-while-expr/cmd
Normal file
1
test/indent/c-family/align-while-expr/cmd
Normal file
|
@ -0,0 +1 @@
|
|||
c<ret><esc>
|
1
test/indent/c-family/align-while-expr/in
Normal file
1
test/indent/c-family/align-while-expr/in
Normal file
|
@ -0,0 +1 @@
|
|||
while (a < b and%( )b >= c)
|
2
test/indent/c-family/align-while-expr/out
Normal file
2
test/indent/c-family/align-while-expr/out
Normal file
|
@ -0,0 +1,2 @@
|
|||
while (a < b and
|
||||
b >= c)
|
3
test/indent/c-family/align-while-expr/rc
Normal file
3
test/indent/c-family/align-while-expr/rc
Normal file
|
@ -0,0 +1,3 @@
|
|||
source "%val{runtime}/colors/default.kak"
|
||||
source "%val{runtime}/rc/core/c-family.kak"
|
||||
set buffer filetype cpp
|
Loading…
Reference in New Issue
Block a user