diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c index 1686e537f616..7bf739a7379b 100644 --- a/usr.bin/indent/indent.c +++ b/usr.bin/indent/indent.c @@ -1058,7 +1058,9 @@ main(int argc, char **argv) if (ps.p_l_follow == 0) { if (ps.block_init_level <= 0) ps.block_init = 0; - if (break_comma && (!ps.leave_comma || compute_code_target() + (e_code - s_code) > max_col - tabsize)) + if (break_comma && (!ps.leave_comma || + count_spaces_until(compute_code_target(), s_code, e_code) > + max_col - tabsize)) force_nl = true; } break; diff --git a/usr.bin/indent/tests/declarations.0 b/usr.bin/indent/tests/declarations.0 index a5482846ec02..875c1d076ed8 100644 --- a/usr.bin/indent/tests/declarations.0 +++ b/usr.bin/indent/tests/declarations.0 @@ -44,6 +44,7 @@ void t2 (char *x, int y) ,n ,o ; + int chars[ /* push the comma beyond column 74 .... */ ], x; } const int int_minimum_size = diff --git a/usr.bin/indent/tests/declarations.0.stdout b/usr.bin/indent/tests/declarations.0.stdout index 9c8384255d8b..99cb4191ff28 100644 --- a/usr.bin/indent/tests/declarations.0.stdout +++ b/usr.bin/indent/tests/declarations.0.stdout @@ -36,6 +36,8 @@ t2(char *x, int y) ,n ,o ; + int chars[ /* push the comma beyond column 74 .... */ ], + x; } const int int_minimum_size =