Fix corner case in C family indenting

This commit is contained in:
Maxime Coste 2017-06-13 10:19:38 +01:00
parent 98627726cf
commit e73cd78288
5 changed files with 9 additions and 2 deletions

View File

@ -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 # on a previous line if its followed by text on the same line
try %< eval -draft %< try %< eval -draft %<
# Go to opening parenthesis and opening brace, then select the most nested one # 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 # 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 # Remove eventual indent from new line
try %< exec -draft <space> <a-h> s\h+<ret> d > try %< exec -draft <space> <a-h> s\h+<ret> d >
# Now align that new line with the opening parenthesis/brace # Now align that new line with the opening parenthesis/brace

View File

@ -0,0 +1 @@
c<ret><esc>

View File

@ -0,0 +1 @@
while (a < b and%( )b >= c)

View File

@ -0,0 +1,2 @@
while (a < b and
b >= c)

View File

@ -0,0 +1,3 @@
source "%val{runtime}/colors/default.kak"
source "%val{runtime}/rc/core/c-family.kak"
set buffer filetype cpp