in open_(prev|next)_file(), translate the "New Buffer" string when

displaying "Switched to" messages on the statusbar; also do a few more
int -> bool conversions


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1959 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2004-10-03 19:18:48 +00:00
parent 7c1f17ab6d
commit 3e189a8b9c
4 changed files with 18 additions and 15 deletions

View File

@ -76,6 +76,9 @@ CVS code -
- Simplify by reusing variables whereever possible, and add a
parameter execute to indicate whether or not to be in "Execute
Command" mode. (DLR)
- open_prevfile(), open_nextfile()
- Translate the "New Buffer" string when displaying "Switched
to" messages on the statusbar. (DLR)
- global.c:
shortcut_init()
- Remove redundant NANO_SMALL #ifdef. (DLR)

View File

@ -696,7 +696,7 @@ void free_openfilestruct(openfilestruct *src)
* FALSE, a new entry is created; otherwise, the current entry is
* updated.
*/
void add_open_file(int update)
void add_open_file(bool update)
{
openfilestruct *tmp;
@ -849,7 +849,7 @@ void load_open_file(void)
* Otherwise, we are about to close that entry, so don't bother doing
* so.
*/
void open_prevfile(int closing_file)
void open_prevfile(bool closing_file)
{
if (open_files == NULL)
return;
@ -891,7 +891,7 @@ void open_prevfile(int closing_file)
load_open_file();
statusbar(_("Switched to %s"),
((open_files->filename[0] == '\0') ? "New Buffer" :
((open_files->filename[0] == '\0') ? _("New Buffer") :
open_files->filename));
#ifdef DEBUG
@ -909,7 +909,7 @@ void open_prevfile_void(void)
* FALSE, update the current entry before switching from it. Otherwise,
* we are about to close that entry, so don't bother doing so.
*/
void open_nextfile(int closing_file)
void open_nextfile(bool closing_file)
{
if (open_files == NULL)
return;
@ -951,7 +951,7 @@ void open_nextfile(int closing_file)
load_open_file();
statusbar(_("Switched to %s"),
((open_files->filename[0] == '\0') ? "New Buffer" :
((open_files->filename[0] == '\0') ? _("New Buffer") :
open_files->filename));
#ifdef DEBUG
@ -967,14 +967,14 @@ void open_nextfile_void(void)
/*
* Delete an entry from the open_files filestruct. After deletion of an
* entry, the next or previous entry is opened, whichever is found first.
* Return 0 on success or 1 on error.
* Return TRUE on success or FALSE on error.
*/
int close_open_file(void)
bool close_open_file(void)
{
openfilestruct *tmp;
if (open_files == NULL)
return 1;
return FALSE;
/* make sure open_files->fileage and fileage, and open_files->filebot
and filebot, are in sync; they might not be if lines have been cut
@ -988,14 +988,14 @@ int close_open_file(void)
else if (open_files->prev != NULL)
open_prevfile(TRUE);
else
return 1;
return FALSE;
unlink_opennode(tmp);
delete_opennode(tmp);
shortcut_init(FALSE);
display_main_list();
return 0;
return TRUE;
}
#endif /* ENABLE_MULTIBUFFER */

View File

@ -2688,7 +2688,7 @@ void do_exit(void)
if (i == 0 || (i == 1 && do_writeout(TRUE) > 0)) {
#ifdef ENABLE_MULTIBUFFER
/* Exit only if there are no more open buffers. */
if (close_open_file() != 0)
if (!close_open_file())
#endif
finish();
} else if (i != 1)

View File

@ -190,13 +190,13 @@ void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
void unlink_opennode(const openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr);
void free_openfilestruct(openfilestruct *src);
void add_open_file(int update);
void add_open_file(bool update);
void load_open_file(void);
void open_prevfile(int closing_file);
void open_prevfile(bool closing_file);
void open_prevfile_void(void);
void open_nextfile(int closing_file);
void open_nextfile(bool closing_file);
void open_nextfile_void(void);
int close_open_file(void);
bool close_open_file(void);
#endif
#if !defined(DISABLE_SPELLER) || !defined(DISABLE_OPERATINGDIR)
char *get_full_path(const char *origpath);