commit 7e422402d58159f62713faa19c6be3b2c7eddbbf
parent 5f03c20ea0a8832cf1db43ef0b9d39ab278929f1
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 29 May 2019 20:02:50 +0200
tweaks: change a function to void, to make things more direct
Diffstat:
3 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -647,13 +647,10 @@ void switch_to_next_buffer(void)
switch_to_adjacent_buffer(FORWARD);
}
-/* Delete an entry from the circular list of open files, and switch to the
- * one after it. Return FALSE if just one buffer is open, otherwise TRUE. */
-bool close_buffer(void)
+/* Delete the current entry from the circular list of open files,
+ * after switching to the buffer after it. */
+void close_buffer(void)
{
- if (openfile == openfile->next)
- return FALSE;
-
#ifdef ENABLE_HISTORIES
if (ISSET(POSITIONLOG) && !inhelp)
update_poshistory(openfile->filename,
@@ -670,8 +667,6 @@ bool close_buffer(void)
/* If now just one buffer remains open, show "Exit" in the help lines. */
if (openfile == openfile->next)
exitfunc->desc = exit_tag;
-
- return TRUE;
}
#endif /* ENABLE_MULTIBUFFER */
diff --git a/src/nano.c b/src/nano.c
@@ -1027,7 +1027,7 @@ void do_exit(void)
statusbar(_("Cancelled"));
}
-/* Close the current buffer, and terminate nano if it was the last. */
+/* Close the current buffer, or terminate nano if it is the last. */
void close_and_go(void)
{
#ifndef NANO_TINY
@@ -1036,8 +1036,10 @@ void close_and_go(void)
delete_lockfile(openfile->lock_filename);
#endif
#ifdef ENABLE_MULTIBUFFER
- /* If there are no more open file buffers, jump off a cliff. */
- if (!close_buffer())
+ /* If there is another buffer, close this one; otherwise terminate. */
+ if (openfile != openfile->next)
+ close_buffer();
+ else
#endif
finish();
}
diff --git a/src/proto.h b/src/proto.h
@@ -276,7 +276,7 @@ void prepare_for_display(void);
void mention_name_and_linecount(void);
void switch_to_prev_buffer(void);
void switch_to_next_buffer(void);
-bool close_buffer(void);
+void close_buffer(void);
#endif
void read_file(FILE *f, int fd, const char *filename, bool undoable);
int open_file(const char *filename, bool newfie, FILE **f);