Only indent once for continuation lines when not lining up with
parentheses if the continuation indent is exactly half of the main indent. Indenting one contination indent for every level of parentheses gives bad results in most cases and is not what is done in about 90% of properly hand-formatted KNF code (sys/kern/*.c, nvi/common/*.c). The main advantage of the non-default KNF options -nlp -ci4 is that continuation lines don't accidentally line up with the next main indentation level or march to the right, and increasing their indentation defeats this. This behaviour change is limited to when the continuation indent is exactly half of the main indent to avoid adding yet another option.
This commit is contained in:
parent
06d48e1164
commit
6b3e10fb1f
@ -34,7 +34,7 @@
|
||||
.\" @(#)indent.1 8.1 (Berkeley) 7/1/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 1, 1993
|
||||
.Dd Februrary 13, 2004
|
||||
.Dt INDENT 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -196,7 +196,8 @@ lines will be indented that far from the beginning of the first line of the
|
||||
statement. Parenthesized expressions have extra indentation added to
|
||||
indicate the nesting, unless
|
||||
.Fl \&lp
|
||||
is in effect.
|
||||
is in effect
|
||||
or the contination indent is exactly half of the main indent.
|
||||
.Fl \&ci
|
||||
defaults to the same value as
|
||||
.Fl i .
|
||||
|
@ -295,7 +295,8 @@ compute_code_target(void)
|
||||
|
||||
if (ps.paren_level)
|
||||
if (!lineup_to_parens)
|
||||
target_col += continuation_indent * ps.paren_level;
|
||||
target_col += continuation_indent
|
||||
* (2 * continuation_indent == ps.ind_size ? 1 : ps.paren_level);
|
||||
else {
|
||||
int w;
|
||||
int t = paren_target;
|
||||
|
Loading…
Reference in New Issue
Block a user