Skip to content

Commit

Permalink
Use 3 as the minimum width of formatted line numbers
Browse files Browse the repository at this point in the history
It gives a more pleasant experience when "digging" through commits.
And of course, most commits will have diffs smaller than 1000 lines!?
For the blame view it means less flickering in the startup when the
whole file is read.
  • Loading branch information
jonas committed Apr 4, 2008
1 parent d9d43d6 commit c811600
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tig.c
Expand Up @@ -1490,14 +1490,15 @@ draw_lineno(struct view *view, unsigned int lineno, int max, bool selected)
{
static char fmt[] = "%1ld";
char number[10] = " ";
int max_number = MIN(view->digits, STRING_SIZE(number));
int digits3 = view->digits < 3 ? 3 : view->digits;
int max_number = MIN(digits3, STRING_SIZE(number));
bool showtrimmed = FALSE;
int col;

lineno += view->offset + 1;
if (lineno == 1 || (lineno % opt_num_interval) == 0) {
if (view->digits <= 9)
fmt[1] = '0' + view->digits;
fmt[1] = '0' + digits3;

if (!string_format(number, fmt, lineno))
number[0] = 0;
Expand Down

0 comments on commit c811600

Please sign in to comment.