File tree Expand file tree Collapse file tree 3 files changed +16
-15
lines changed Expand file tree Collapse file tree 3 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -1828,18 +1828,6 @@ static int read_ancestry(const char *graft_file)
1828
1828
return 0 ;
1829
1829
}
1830
1830
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
-
1843
1831
/*
1844
1832
* How many columns do we need to show line numbers, authors,
1845
1833
* and filenames?
@@ -1880,9 +1868,9 @@ static void find_alignment(struct scoreboard *sb, int *option)
1880
1868
if (largest_score < ent_score (sb , e ))
1881
1869
largest_score = ent_score (sb , e );
1882
1870
}
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 );
1886
1874
}
1887
1875
1888
1876
/*
Original file line number Diff line number Diff line change @@ -1178,6 +1178,7 @@ extern const char *pager_program;
1178
1178
extern int pager_in_use (void );
1179
1179
extern int pager_use_color ;
1180
1180
extern int term_columns (void );
1181
+ extern int decimal_width (int );
1181
1182
1182
1183
extern const char * editor_program ;
1183
1184
extern const char * askpass_program ;
Original file line number Diff line number Diff line change @@ -147,3 +147,15 @@ int term_columns(void)
147
147
148
148
return term_columns_at_startup ;
149
149
}
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