Author: pstef
Date: Fri Jun  1 09:32:42 2018
New Revision: 334477
URL: https://svnweb.freebsd.org/changeset/base/334477

Log:
  indent(1): consider tab characters when forcing a newline after a comma

Modified:
  head/usr.bin/indent/indent.c
  head/usr.bin/indent/tests/declarations.0
  head/usr.bin/indent/tests/declarations.0.stdout

Modified: head/usr.bin/indent/indent.c
==============================================================================
--- head/usr.bin/indent/indent.c        Fri Jun  1 09:17:20 2018        
(r334476)
+++ head/usr.bin/indent/indent.c        Fri Jun  1 09:32:42 2018        
(r334477)
@@ -1058,7 +1058,9 @@ check_type:
            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;

Modified: head/usr.bin/indent/tests/declarations.0
==============================================================================
--- head/usr.bin/indent/tests/declarations.0    Fri Jun  1 09:17:20 2018        
(r334476)
+++ head/usr.bin/indent/tests/declarations.0    Fri Jun  1 09:32:42 2018        
(r334477)
@@ -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 =

Modified: head/usr.bin/indent/tests/declarations.0.stdout
==============================================================================
--- head/usr.bin/indent/tests/declarations.0.stdout     Fri Jun  1 09:17:20 
2018        (r334476)
+++ head/usr.bin/indent/tests/declarations.0.stdout     Fri Jun  1 09:32:42 
2018        (r334477)
@@ -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 =
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to