Fix bug in c-family indentation logic after visibility labels

Fixes #872
This commit is contained in:
Maxime Coste 2016-10-16 19:27:53 +01:00
parent 19f65f4c6e
commit 1431dcff46
5 changed files with 25 additions and 1 deletions

View File

@ -54,7 +54,7 @@ def -hidden _c-family-indent-on-newline %[ eval -draft -itersel %[
## indent after an opening brace ## indent after an opening brace
try %[ exec -draft K s\{\h*$<ret> j <a-gt> ] try %[ exec -draft K s\{\h*$<ret> j <a-gt> ]
## indent after a label ## indent after a label
try %[ exec -draft K <a-x> s[a-zA-Z0-9_-]+:\h*$<ret> j <a-gt> ] try %[ exec -draft k <a-x> s[a-zA-Z0-9_-]+:\h*$<ret> j <a-gt> ]
## indent after a statement not followed by an opening brace ## indent after a statement not followed by an opening brace
try %[ exec -draft k <a-x> <a-k>\b(if|else|for|while)\h*\(.+?\)\h*$<ret> j <a-gt> ] try %[ exec -draft k <a-x> <a-k>\b(if|else|for|while)\h*\(.+?\)\h*$<ret> j <a-gt> ]
## align to the opening parenthesis on a previous line if its followed by text on the same line ## align to the opening parenthesis on a previous line if its followed by text on the same line

View File

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

View File

@ -0,0 +1,9 @@
class foo {
%(p)rivate:
int a;
int b;
public:
foo() {}
void bar() {
}
};

View File

@ -0,0 +1,10 @@
class foo {
private:
int a;
int b;
public:
foo() {}
void bar() {
}
};

View File

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