indent(1): better alignment of comments on code.

If aligning the beginning of a comment to -cn would mean no space between
code and the comment, align it to the next tab stop.
This commit is contained in:
pstef 2017-07-23 20:25:53 +00:00
parent 65ce87ce40
commit 3d441a7064
3 changed files with 15 additions and 1 deletions

View File

@ -141,7 +141,7 @@ pr_comment(void)
target_col = count_spaces(compute_label_target(), s_lab);
}
ps.com_col = ps.decl_on_line || ps.ind_level == 0 ? ps.decl_com_ind : ps.com_ind;
if (ps.com_col < target_col)
if (ps.com_col <= target_col)
ps.com_col = ((target_col + 7) & ~7) + 1;
if (ps.com_col + 24 > adj_max_col)
adj_max_col = ps.com_col + 24;

View File

@ -1,4 +1,11 @@
/* $FreeBSD$ */
typedef enum x {
aaaaaaaaaaaaaaaaaaaaaa = 1 << 0, /* test a */
bbbbbbbbbbbbbbbbb = 1 << 1, /* test b */
cccccccccccccc = 1 << 1, /* test c */
dddddddddddddddddddddddddddddd = 1 << 2 /* test d */
} x;
/* See r303597, r303598, r309219, and r309343 */
void t(void) {
/*

View File

@ -1,4 +1,11 @@
/* $FreeBSD$ */
typedef enum x {
aaaaaaaaaaaaaaaaaaaaaa = 1 << 0, /* test a */
bbbbbbbbbbbbbbbbb = 1 << 1, /* test b */
cccccccccccccc = 1 << 1, /* test c */
dddddddddddddddddddddddddddddd = 1 << 2 /* test d */
} x;
/* See r303597, r303598, r309219, and r309343 */
void
t(void)