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

This commit is contained in:
Benno Schulenberg 2020-08-16 11:24:13 +02:00
parent b86f7868d1
commit 2b6c08b955

View File

@ -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 */