Skip to content

Commit feec2a8

Browse files
committed
Add indent_braces_no_class option
1 parent b2354a0 commit feec2a8

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/indent.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,11 @@ void indent_text(void)
728728
{
729729
brace_indent = (cpd.settings[UO_indent_braces].b &&
730730
(!cpd.settings[UO_indent_braces_no_func].b ||
731-
(pc->parent_type != CT_FUNC_DEF)));
731+
(pc->parent_type != CT_FUNC_DEF)) &&
732+
(!cpd.settings[UO_indent_braces_no_func].b ||
733+
(pc->parent_type != CT_FUNC_CLASS)) &&
734+
(!cpd.settings[UO_indent_braces_no_class].b ||
735+
(pc->parent_type != CT_CLASS)));
732736
}
733737

734738
if (pc->type == CT_BRACE_CLOSE)

src/options.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,8 @@ void register_options(void)
463463
"Whether braces are indented to the body level");
464464
unc_add_option("indent_braces_no_func", UO_indent_braces_no_func, AT_BOOL,
465465
"Disabled indenting function braces if indent_braces is true");
466+
unc_add_option("indent_braces_no_class", UO_indent_braces_no_class, AT_BOOL,
467+
"Disabled indenting class braces if indent_braces is true");
466468
unc_add_option("indent_brace_parent", UO_indent_brace_parent, AT_BOOL,
467469
"Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc.");
468470
unc_add_option("indent_namespace", UO_indent_namespace, AT_BOOL,

src/options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ enum uncrustify_options
127127
UO_indent_brace, // spaces to indent '{' from level (usually 0)
128128
UO_indent_braces, // whether to indent the braces or not
129129
UO_indent_braces_no_func, // whether to not indent the function braces (depends on UO_indent_braces)
130+
UO_indent_braces_no_class, // whether to not indent the class braces (depends on UO_indent_braces)
130131
UO_indent_brace_parent, // indent the braces based on the parent size (if=3, for=4, etc)
131132
UO_indent_label, // 0=left >0=col from left, <0=sub from brace indent
132133
UO_indent_access_spec, // same as indent_label, but for "private:", "public:"

0 commit comments

Comments
 (0)