Make help lines show "Close" again when more than one buffer is open.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4816 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Benno Schulenberg 2014-04-26 19:01:18 +00:00
parent 20b1e92857
commit 11d76449d2
4 changed files with 18 additions and 7 deletions

View File

@ -2,6 +2,8 @@
* src/global.c (add_to_funcs): Add a pointer to the tail of the
functions list, to simplify and speed up adding new items. And
make use of it to remember the location of the Uncut item.
* src/global.c, src/files.c (make_new_buffer, close_buffer): Make
help lines show "Close" again when more than one buffer is open.
2014-04-24 Benno Schulenberg <bensberg@justemail.net>
* doc/faq.html: Update a few URLs, delete some obsolete ones, update

View File

@ -47,6 +47,8 @@ void make_new_buffer(void)
} else {
splice_opennode(openfile, make_new_opennode(), openfile->next);
openfile = openfile->next;
/* More than one file open, show Close in help lines. */
exitfunc->desc = close_tag;
}
/* Initialize the new buffer. */
@ -485,7 +487,9 @@ bool close_buffer(void)
/* Close the file buffer we had open before. */
unlink_opennode(openfile->prev);
display_main_list();
/* If only one buffer is open now, show Exit in the help lines. */
if (openfile == openfile->next)
exitfunc->desc = exit_tag;
return TRUE;
}

View File

@ -172,6 +172,8 @@ subnfunc *allfuncs = NULL;
/* Pointer to the start of the functions list. */
subnfunc *tailfunc;
/* Pointer to the last function in the list. */
subnfunc *exitfunc;
/* Pointer to the special Exit/Close item. */
subnfunc *uncutfunc;
/* Pointer to the special Uncut/Unjustify item. */
@ -460,7 +462,9 @@ void print_sclist(void)
}
#endif
/* TRANSLATORS: Try to keep the next two strings at most 10 characters. */
/* TRANSLATORS: Try to keep the next four strings at most 10 characters. */
const char *exit_tag = N_("Exit");
const char *close_tag = N_("Close");
const char *uncut_tag = N_("Uncut Text");
#ifndef DISABLE_JUSITIFY
const char *unjust_tag = N_("Unjustify");
@ -473,8 +477,7 @@ const char *whereis_next_tag = N_("WhereIs Next");
/* Initialize the list of functions and the list of shortcuts. */
void shortcut_init(void)
{
/* TRANSLATORS: Try to keep the next seven strings at most 10 characters. */
const char *exit_tag = N_("Exit");
/* TRANSLATORS: Try to keep the next six strings at most 10 characters. */
const char *whereis_tag = N_("Where Is");
const char *prev_line_tag = N_("Prev Line");
const char *next_line_tag = N_("Next Line");
@ -666,10 +669,9 @@ void shortcut_init(void)
N_("Cancel"), IFSCHELP(nano_cancel_msg), FALSE, VIEW);
add_to_funcs(do_exit, MMAIN,
#ifndef DISABLE_MULTIBUFFER
openfile != NULL && openfile != openfile->next ? N_("Close") :
#endif
exit_tag, IFSCHELP(nano_exit_msg), FALSE, VIEW);
/* Remember the entry for Exit, to be able to replace it with Close. */
exitfunc = tailfunc;
#ifndef DISABLE_BROWSER
add_to_funcs(do_exit, MBROWSER, exit_tag, IFSCHELP(nano_exitbrowser_msg), FALSE, VIEW);

View File

@ -66,6 +66,8 @@ extern int whitespace_len[2];
extern undo_type last_action;
#endif
extern const char *exit_tag;
extern const char *close_tag;
extern const char *uncut_tag;
#ifndef DISABLE_JUSTIFY
extern const char *unjust_tag;
@ -101,6 +103,7 @@ extern char *alt_speller;
extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *exitfunc;
extern subnfunc *uncutfunc;
#ifndef DISABLE_COLOR
extern syntaxtype *syntaxes;