summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenno Schulenberg <bensberg@telfort.nl>2019-05-29 20:02:50 +0200
committerBenno Schulenberg <bensberg@telfort.nl>2019-05-29 20:02:50 +0200
commit7e422402d58159f62713faa19c6be3b2c7eddbbf (patch)
tree74286a932c6caa050d9b8868207c44e68ce3aff7
parent5f03c20ea0a8832cf1db43ef0b9d39ab278929f1 (diff)
downloadnano-7e422402.tar.gz
tweaks: change a function to void, to make things more direct
-rw-r--r--src/files.c11
-rw-r--r--src/nano.c8
-rw-r--r--src/proto.h2
3 files changed, 9 insertions, 12 deletions
diff --git a/src/files.c b/src/files.c
index c8513ab..f92a74a 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 481c07c..d304c26 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 559b3b1..4e24a36 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);