From 7e422402d58159f62713faa19c6be3b2c7eddbbf Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 29 May 2019 20:02:50 +0200 Subject: [PATCH] tweaks: change a function to void, to make things more direct --- src/files.c | 11 +++-------- src/nano.c | 8 +++++--- src/proto.h | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/files.c b/src/files.c index c8513abe..f92a74ab 100644 --- 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 index 481c07cd..d304c26d 100644 --- 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 index 559b3b12..4e24a367 100644 --- 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);