From d5231c713e4b62f113103ea7eff00ff796be479f Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 2 Jan 2017 04:15:12 +0000 Subject: [PATCH] Fix corner case in C indentation --- rc/core/c-family.kak | 2 +- test/indent/c-family/move-brace/cmd | 1 + test/indent/c-family/move-brace/in | 3 +++ test/indent/c-family/move-brace/out | 4 ++++ test/indent/c-family/move-brace/rc | 3 +++ 5 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test/indent/c-family/move-brace/cmd create mode 100644 test/indent/c-family/move-brace/in create mode 100644 test/indent/c-family/move-brace/out create mode 100644 test/indent/c-family/move-brace/rc diff --git a/rc/core/c-family.kak b/rc/core/c-family.kak index 3d446e9f..78949de5 100644 --- a/rc/core/c-family.kak +++ b/rc/core/c-family.kak @@ -40,7 +40,7 @@ def -hidden c-family-indent-on-newline %[ eval -draft -itersel %[ # remove previous empty lines resulting from the automatic indent try %[ exec -draft k ^\h+$ Hd ] # indent after an opening brace - try %[ exec -draft K s\{\h*$ j ] + try %[ exec -draft k s\{\h*$ j ] # indent after a label try %[ exec -draft k s[a-zA-Z0-9_-]+:\h*$ j ] # indent after a statement not followed by an opening brace diff --git a/test/indent/c-family/move-brace/cmd b/test/indent/c-family/move-brace/cmd new file mode 100644 index 00000000..54aed4f8 --- /dev/null +++ b/test/indent/c-family/move-brace/cmd @@ -0,0 +1 @@ +i diff --git a/test/indent/c-family/move-brace/in b/test/indent/c-family/move-brace/in new file mode 100644 index 00000000..7ebe9d97 --- /dev/null +++ b/test/indent/c-family/move-brace/in @@ -0,0 +1,3 @@ +namespace A +%({) +struct B; diff --git a/test/indent/c-family/move-brace/out b/test/indent/c-family/move-brace/out new file mode 100644 index 00000000..126487cb --- /dev/null +++ b/test/indent/c-family/move-brace/out @@ -0,0 +1,4 @@ +namespace A + +{ +struct B; diff --git a/test/indent/c-family/move-brace/rc b/test/indent/c-family/move-brace/rc new file mode 100644 index 00000000..53c40654 --- /dev/null +++ b/test/indent/c-family/move-brace/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/core/c-family.kak" +set buffer filetype cpp