diff --git a/rc/core/c-family.kak b/rc/core/c-family.kak index 2f9ab31f..3898efcb 100644 --- a/rc/core/c-family.kak +++ b/rc/core/c-family.kak @@ -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[B > catch %< exec [B > + try %< try %< exec [bZ[B > catch %< exec [B > > # Validate selection and get first and last char - exec \`[{(](\h*\S+)+\n L s\`|.\' + exec \`[{(](\h*\S+)+\n L s\`|.\' # Remove eventual indent from new line try %< exec -draft s\h+ d > # Now align that new line with the opening parenthesis/brace diff --git a/test/indent/c-family/align-while-expr/cmd b/test/indent/c-family/align-while-expr/cmd new file mode 100644 index 00000000..76003030 --- /dev/null +++ b/test/indent/c-family/align-while-expr/cmd @@ -0,0 +1 @@ +c diff --git a/test/indent/c-family/align-while-expr/in b/test/indent/c-family/align-while-expr/in new file mode 100644 index 00000000..85f2a9c0 --- /dev/null +++ b/test/indent/c-family/align-while-expr/in @@ -0,0 +1 @@ +while (a < b and%( )b >= c) diff --git a/test/indent/c-family/align-while-expr/out b/test/indent/c-family/align-while-expr/out new file mode 100644 index 00000000..156de3dd --- /dev/null +++ b/test/indent/c-family/align-while-expr/out @@ -0,0 +1,2 @@ +while (a < b and + b >= c) diff --git a/test/indent/c-family/align-while-expr/rc b/test/indent/c-family/align-while-expr/rc new file mode 100644 index 00000000..53c40654 --- /dev/null +++ b/test/indent/c-family/align-while-expr/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/core/c-family.kak" +set buffer filetype cpp