titlebar: don't reshow version when dropping back to a single buffer
When multiple files were open and [x/n] was being shown in the title bar, don't show nano's name and version number when just one buffer remains open, but show [1/1] instead. It is less surprising.master
parent
3fc89e0853
commit
cbf4f77d6b
|
@ -78,6 +78,7 @@ void make_new_buffer(void)
|
||||||
|
|
||||||
/* There is more than one file open: show "Close" in help lines. */
|
/* There is more than one file open: show "Close" in help lines. */
|
||||||
exitfunc->desc = close_tag;
|
exitfunc->desc = close_tag;
|
||||||
|
more_than_one = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make the new buffer the current one, and start initializing it. */
|
/* Make the new buffer the current one, and start initializing it. */
|
||||||
|
|
|
@ -70,6 +70,9 @@ bool inhelp = FALSE;
|
||||||
char *title = NULL;
|
char *title = NULL;
|
||||||
/* When not NULL: the title of the current help text. */
|
/* When not NULL: the title of the current help text. */
|
||||||
|
|
||||||
|
bool more_than_one = FALSE;
|
||||||
|
/* Whether more than one buffer is or has been open. */
|
||||||
|
|
||||||
int didfind = 0;
|
int didfind = 0;
|
||||||
/* Whether the last search found something. */
|
/* Whether the last search found something. */
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,8 @@ extern filestruct *pletion_line;
|
||||||
extern bool inhelp;
|
extern bool inhelp;
|
||||||
extern char *title;
|
extern char *title;
|
||||||
|
|
||||||
|
extern bool more_than_one;
|
||||||
|
|
||||||
extern int didfind;
|
extern int didfind;
|
||||||
|
|
||||||
extern int controlleft;
|
extern int controlleft;
|
||||||
|
|
|
@ -2030,7 +2030,7 @@ void titlebar(const char *path)
|
||||||
* then sacrifice the prefix, and only then start dottifying. */
|
* then sacrifice the prefix, and only then start dottifying. */
|
||||||
|
|
||||||
/* When multiple buffers are open, show which one out of how many. */
|
/* When multiple buffers are open, show which one out of how many. */
|
||||||
if (path == NULL && firstfile != firstfile->next) {
|
if (path == NULL && more_than_one) {
|
||||||
indicator = charalloc(24);
|
indicator = charalloc(24);
|
||||||
sprintf(indicator, "[%i/%i]", buffer_number(openfile),
|
sprintf(indicator, "[%i/%i]", buffer_number(openfile),
|
||||||
buffer_number(firstfile->prev));
|
buffer_number(firstfile->prev));
|
||||||
|
|
Loading…
Reference in New Issue