nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Benno Schulenberg
Subject: [PATCH 6/7] minibar: add an [x/y] "counter" when multiple files are open
Date: Tue, 15 Dec 2020 10:44:08 +0100

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

diff --git a/src/winio.c b/src/winio.c
index 37a5c06d..81947b19 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2070,7 +2070,7 @@ void minibar(void)
        char *thisline = openfile->current->data;
        char *hexadecimal = nmalloc(9);
        char *location = nmalloc(44);
-       char *thename;
+       char *ranking = NULL, *thename = NULL;
        wchar_t widecode;
 
        /* Draw a colored bar over the full width of the screen. */
@@ -2086,6 +2086,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);
@@ -2112,6 +2120,7 @@ void minibar(void)
        free(hexadecimal);
        free(location);
        free(thename);
+       free(ranking);
 }
 #endif /* NANO_TINY */
 
-- 
2.29.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]