mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-30 23:37:17 +03:00
Fix bug in c-family indentation logic after visibility labels
Fixes #872
This commit is contained in:
parent
19f65f4c6e
commit
1431dcff46
@ -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
|
||||||
|
1
test/regression/872-indentation-misbeahviour-c++/cmd
Normal file
1
test/regression/872-indentation-misbeahviour-c++/cmd
Normal file
@ -0,0 +1 @@
|
|||||||
|
i<ret><esc>
|
9
test/regression/872-indentation-misbeahviour-c++/in
Normal file
9
test/regression/872-indentation-misbeahviour-c++/in
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
class foo {
|
||||||
|
%(p)rivate:
|
||||||
|
int a;
|
||||||
|
int b;
|
||||||
|
public:
|
||||||
|
foo() {}
|
||||||
|
void bar() {
|
||||||
|
}
|
||||||
|
};
|
10
test/regression/872-indentation-misbeahviour-c++/out
Normal file
10
test/regression/872-indentation-misbeahviour-c++/out
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
class foo {
|
||||||
|
|
||||||
|
private:
|
||||||
|
int a;
|
||||||
|
int b;
|
||||||
|
public:
|
||||||
|
foo() {}
|
||||||
|
void bar() {
|
||||||
|
}
|
||||||
|
};
|
4
test/regression/872-indentation-misbeahviour-c++/rc
Normal file
4
test/regression/872-indentation-misbeahviour-c++/rc
Normal 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
|
Loading…
Reference in New Issue
Block a user