[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
- [PATCH 1/7] tweaks: move the displaying of the state letters into a separate function, Benno Schulenberg, 2020/12/15
- [PATCH 2/7] display: add code for showing minimal state-information bar at the bottom, Benno Schulenberg, 2020/12/15
- [PATCH 3/7] options: add --minibar and -_ for activating basic state-information bar, Benno Schulenberg, 2020/12/15
- [PATCH 4/7] minibar: show the info bar again some 0.8 seconds after a message, Benno Schulenberg, 2020/12/15
- [PATCH 5/7] feedback: differentiate between remarks, mistakes, and information, Benno Schulenberg, 2020/12/15
- [PATCH 6/7] minibar: add an [x/y] "counter" when multiple files are open,
Benno Schulenberg <=
- [PATCH 7/7] minibar: show the line count in the bar (at startup and when switching), Benno Schulenberg, 2020/12/15