nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 0c1bf429e8e9ec622617b59b96771a90647d36ec
parent f6357a73f0df80c112f99265b9edb032dbf3c34d
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 14 Mar 2021 15:50:23 +0100

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>

Diffstat:
Msrc/winio.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 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. */