From 0c1bf429e8e9ec622617b59b96771a90647d36ec Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 14 Mar 2021 15:50:23 +0100 Subject: [PATCH] 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 --- src/winio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/winio.c b/src/winio.c index f7eaf1d0..9ece36a3 100644 --- a/src/winio.c +++ b/src/winio.c @@ -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. */