diff --git a/src/files.c b/src/files.c index 69f87f08..ff34a1d4 100644 --- a/src/files.c +++ b/src/files.c @@ -501,7 +501,13 @@ void mention_name_and_linecount(void) { size_t count = openfile->filebot->lineno - (openfile->filebot->data[0] == '\0' ? 1 : 0); + #ifndef NANO_TINY + if (ISSET(MINIBAR)) { + report_size = TRUE; + return; + } + if (openfile->fmt != NIX_FILE) /* TRANSLATORS: First %s is file name, second %s is file format. */ statusline(HUSH, P_("%s -- %zu line (%s)", "%s -- %zu lines (%s)", count), @@ -1982,8 +1988,13 @@ bool write_file(const char *name, FILE *thefile, bool tmp, titlebar(NULL); } +#ifndef NANO_TINY + if (ISSET(MINIBAR) && fullbuffer && !tmp) + report_size = TRUE; + else +#endif if (!tmp) - statusline(HUSH, P_("Wrote %zu line", "Wrote %zu lines", + statusline(REMARK, P_("Wrote %zu line", "Wrote %zu lines", lineswritten), lineswritten); retval = TRUE; diff --git a/src/global.c b/src/global.c index 8b2bb7ac..b2177665 100644 --- a/src/global.c +++ b/src/global.c @@ -49,7 +49,8 @@ bool we_are_running = FALSE; /* Becomes TRUE as soon as all options and files have been read. */ bool more_than_one = FALSE; /* Whether more than one buffer is or has been open. */ - +bool report_size = TRUE; + /* Whether to show the number of lines when the minibar is used. */ bool ran_a_tool = FALSE; /* Whether a tool has been run at the Execute-Command prompt. */ diff --git a/src/prototypes.h b/src/prototypes.h index adfb81d1..97e98308 100644 --- a/src/prototypes.h +++ b/src/prototypes.h @@ -36,7 +36,7 @@ extern bool bracketed_paste; extern bool we_are_running; extern bool more_than_one; - +extern bool report_size; extern bool ran_a_tool; extern bool inhelp; diff --git a/src/winio.c b/src/winio.c index f6a64322..9358bc10 100644 --- 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 = NULL, *ranking = NULL; + char *thename = NULL, *number_of_lines = NULL, *ranking = NULL; wchar_t widecode; /* Draw a colored bar over the full width of the screen. */ @@ -2088,8 +2088,16 @@ void minibar(void) mvwaddstr(bottomwin, 0, 2, thename); waddstr(bottomwin, openfile->modified ? " *" : " "); + if (report_size) { + size_t count = openfile->filebot->lineno - (openfile->filebot->data[0] == '\0'); + + number_of_lines = nmalloc(44); + sprintf(number_of_lines, P_(" (%zu line)", " (%zu lines)", count), count); + waddstr(bottomwin, number_of_lines); + report_size = FALSE; + } #ifdef ENABLE_MULTIBUFFER - if (openfile->next != openfile) { + else if (openfile->next != openfile) { ranking = nmalloc(24); sprintf(ranking, " [%i/%i]", buffer_number(openfile), buffer_number(startfile->prev)); waddstr(bottomwin, ranking); @@ -2119,6 +2127,7 @@ void minibar(void) wattroff(bottomwin, interface_color_pair[TITLE_BAR]); wrefresh(bottomwin); + free(number_of_lines); free(hexadecimal); free(location); free(thename);