File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1828,18 +1828,6 @@ static int read_ancestry(const char *graft_file)
18281828 return 0 ;
18291829}
18301830
1831- /*
1832- * How many columns do we need to show line numbers in decimal?
1833- */
1834- static int lineno_width (int lines )
1835- {
1836- int i , width ;
1837-
1838- for (width = 1 , i = 10 ; i <= lines ; width ++ )
1839- i *= 10 ;
1840- return width ;
1841- }
1842-
18431831/*
18441832 * How many columns do we need to show line numbers, authors,
18451833 * and filenames?
@@ -1880,9 +1868,9 @@ static void find_alignment(struct scoreboard *sb, int *option)
18801868 if (largest_score < ent_score (sb , e ))
18811869 largest_score = ent_score (sb , e );
18821870 }
1883- max_orig_digits = lineno_width (longest_src_lines );
1884- max_digits = lineno_width (longest_dst_lines );
1885- max_score_digits = lineno_width (largest_score );
1871+ max_orig_digits = decimal_width (longest_src_lines );
1872+ max_digits = decimal_width (longest_dst_lines );
1873+ max_score_digits = decimal_width (largest_score );
18861874}
18871875
18881876/*
Original file line number Diff line number Diff line change @@ -1178,6 +1178,7 @@ extern const char *pager_program;
11781178extern int pager_in_use (void );
11791179extern int pager_use_color ;
11801180extern int term_columns (void );
1181+ extern int decimal_width (int );
11811182
11821183extern const char * editor_program ;
11831184extern const char * askpass_program ;
Original file line number Diff line number Diff line change @@ -147,3 +147,15 @@ int term_columns(void)
147147
148148 return term_columns_at_startup ;
149149}
150+
151+ /*
152+ * How many columns do we need to show this number in decimal?
153+ */
154+ int decimal_width (int number )
155+ {
156+ int i , width ;
157+
158+ for (width = 1 , i = 10 ; i <= number ; width ++ )
159+ i *= 10 ;
160+ return width ;
161+ }
You can’t perform that action at this time.
0 commit comments