From 69a28122c1c0f6cc783d9cff03f9fd7ddaf9c0bc Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Thu, 12 Aug 2004 04:34:00 +0000
Subject: [PATCH] make sure that the shortcut list properly displays "Close"
 when reading in multiple files on the command line

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1895 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog  |  5 ++++-
 src/nano.c | 17 +++++++++++------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ee4e9e63..6e95a051 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -163,7 +163,10 @@ CVS code -
 	  NLS is enabled or not. (Junichi Uekawa)
 	- Add titlebar() calls before all open_file() calls and remove 
 	  the titlebar() call after them, so that the titlebar is 
-	  displayed properly for all file(s) loaded. (DLR)
+	  displayed properly for all file(s) loaded.  Also call
+	  display_main_list() after adding the first file to open_files,
+	  so that "Close" is properly displayed then instead of "Exit".
+	  (DLR)
 - nano.h:
 	- Reassign the key for full justification to Ctrl-U, for
 	  compatibility with the current version of Pico. (DLR)
diff --git a/src/nano.c b/src/nano.c
index 2b0079b6..179eb8d3 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -3459,23 +3459,21 @@ int main(int argc, char *argv[])
 #endif
 
 #ifdef DEBUG
-    fprintf(stderr, "Main: bottom win\n");
+    fprintf(stderr, "Main: top and bottom win\n");
 #endif
-    /* Set up bottom of window */
+    titlebar(NULL);
     display_main_list();
 
 #ifdef DEBUG
     fprintf(stderr, "Main: open file\n");
 #endif
-
-    titlebar(NULL);
     open_file(filename, FALSE, FALSE);
 #ifdef ENABLE_MULTIBUFFER
     /* If we're using multibuffers and more than one file is specified
        on the command line, load them all and switch to the first one
-       afterward */
+       afterward. */
     if (optind + 1 < argc) {
-	bool old_multibuffer = ISSET(MULTIBUFFER);
+	bool old_multibuffer = ISSET(MULTIBUFFER), list = FALSE;
 	SET(MULTIBUFFER);
 	for (optind++; optind < argc; optind++) {
 	    add_open_file(TRUE);
@@ -3484,6 +3482,13 @@ int main(int argc, char *argv[])
 	    titlebar(NULL);
 	    open_file(filename, FALSE, FALSE);
 	    load_file(FALSE);
+	    /* Display the main list with "Close" if we haven't 
+	     * already. */
+	    if (!list) {
+		shortcut_init(FALSE);
+		list = TRUE;
+		display_main_list();
+	    }
 	}
 	open_nextfile_void();
 	if (!old_multibuffer)
-- 
GitLab