display: make the output of --constantshow less jittery

That is: reserve for the current line and current character the number
of positions needed for the total number of lines and characters, and
reserve two positions for both the current column and the total number
of columns.  This will keep all nine numbers in the output in the same
place -- as long as there are no lines with more than 99 columns.  In
this latter case there will still be some jitter, but all-in-all the
output is much stabler than it was.

Suggested-by: Mike Frysinger <vapier@gentoo.org>
master
Benno Schulenberg 2021-03-14 15:50:23 +01:00
parent f6357a73f0
commit 0c1bf429e8
1 changed files with 4 additions and 2 deletions

View File

@ -3478,9 +3478,11 @@ void report_cursor_position(void)
charpct = (openfile->totsize == 0) ? 0 : 100 * sum / openfile->totsize;
statusline(INFO,
_("line %zd/%zd (%d%%), col %zu/%zu (%d%%), char %zu/%zu (%d%%)"),
_("line %*zd/%zd (%2d%%), col %2zu/%2zu (%3d%%), char %*zu/%zu (%2d%%)"),
digits(openfile->filebot->lineno),
openfile->current->lineno, openfile->filebot->lineno, linepct,
column, fullwidth, colpct, sum, openfile->totsize, charpct);
column, fullwidth, colpct,
digits(openfile->totsize), sum, openfile->totsize, charpct);
}
/* Highlight the text between the given two columns on the current line. */