nano

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

commit 2b6c08b955f90f9d3c2a31a7c3471797c3cfb353
parent b86f7868d12940fb2ebfdc2f63247a4b8ee095ba
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 16 Aug 2020 11:24:13 +0200

minibar: add an [x/y] "counter" when multiple files are open

Diffstat:
Msrc/winio.c | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/winio.c b/src/winio.c @@ -2072,7 +2072,7 @@ void minibar(void) char *thisline = openfile->current->data; char *hexadecimal = nmalloc(9); char *location = nmalloc(44); - char *thename; + char *thename = NULL, *ranking = NULL; wchar_t widecode; /* Draw a colored bar over the full width of the screen. */ @@ -2088,6 +2088,14 @@ void minibar(void) mvwaddstr(bottomwin, 0, 2, thename); waddstr(bottomwin, openfile->modified ? " *" : " "); +#ifdef ENABLE_MULTIBUFFER + if (openfile->next != openfile) { + ranking = nmalloc(24); + sprintf(ranking, " [%i/%i]", buffer_number(openfile), buffer_number(startfile->prev)); + waddstr(bottomwin, ranking); + } +#endif + /* Display the line/column position of the cursor. */ sprintf(location, "%zi,%lu", openfile->current->lineno, xplustabs() + 1); mvwaddstr(bottomwin, 0, COLS - 21 - strlen(location), location); @@ -2114,6 +2122,7 @@ void minibar(void) free(hexadecimal); free(location); free(thename); + free(ranking); } #endif /* NANO_TINY */