From: Chris Allegretta <chrisa@asty.org>
Date: Mon, 7 Dec 2009 12:34:23 +0000 (+0000)
Subject: 2009-12-07 David Lawrence Ramsey <pooka109@gmail.com>
X-Git-Tag: v2.2.1~4
X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=5b25e0774448ff18476a765fb8407491e711b8b5;p=nano.git

2009-12-07 David Lawrence Ramsey <pooka109@gmail.com>
        * global.c (shortcut_init): Many fixes for keybindings code oversights, including
          restore page up/down and GotoDir to browser,
        * browser.c (do_browser): Fix breaking out of a submenu (e.g. gotodir) breaks out
          of browser altogether.
        * doc/nanorc.sample.in: Add missing entries for fortran/ObjC/OCaml entries.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4459 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---

diff --git a/ChangeLog b/ChangeLog
index 612a6842..da71c6fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-12-07 David Lawrence Ramsey <pooka109@gmail.com>
+	* global.c (shortcut_init): Many fixes for keybindings code oversights, including
+	  restore page up/down and GotoDir to browser, 
+	* browser.c (do_browser): Fix breaking out of a submenu (e.g. gotodir) breaks out
+	  of browser altogether.
+	* doc/nanorc.sample.in: Add missing entries for fortran/ObjC/OCaml entries.
+
 2009-12-03 David Lawrence Ramsey <pooka109@gmail.com>
 	* global.c (shortcut_init) - Remove help shortcut from help shortcut list :-)  Tweaked 
 	  to reorder exit shortcut to end of list to not mess up prev/next shortcut symmetry.
diff --git a/doc/nanorc.sample.in b/doc/nanorc.sample.in
index 518c279e..576c490e 100644
--- a/doc/nanorc.sample.in
+++ b/doc/nanorc.sample.in
@@ -291,6 +291,15 @@
 ## Java
 # include "@PKGDATADIR@/java.nanorc"
 
+## Fortran
+# include "@PKGDATADIR@/fortran.nanorc"
+
+## Objective-C
+# include "@PKGDATADIR@/objc.nanorc"
+
+## OCaml
+# include "@PKGDATADIR@/ocaml.nanorc"
+
 ## AWK
 # include "@PKGDATADIR@/awk.nanorc"
 
diff --git a/src/browser.c b/src/browser.c
index fd5329fe..fca72e3c 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -232,7 +232,7 @@ char *do_browser(char *path, DIR *dir)
 		     * blank out ans, since we're done with it. */
 		    statusbar(_("Cancelled"));
 		    ans = mallocstrcpy(ans, "");
-		    break;
+		    continue;
 		} else if (i != 0) {
 		    /* Put back the "Go to Directory" key and save
 		     * answer in ans, so that the file list is displayed
@@ -240,7 +240,7 @@ char *do_browser(char *path, DIR *dir)
 		     * typed before at the prompt is displayed again. */
 		    unget_kbinput(sc_seq_or(DO_GOTOLINECOLUMN_VOID, 0), FALSE, FALSE);
 		    ans = mallocstrcpy(ans, answer);
-		    break;
+		    continue;
 		}
 
 		/* We have a directory.  Blank out ans, since we're done
@@ -266,7 +266,7 @@ char *do_browser(char *path, DIR *dir)
 			_("Can't go outside of %s in restricted mode"),
 			operating_dir);
 		    free(new_path);
-		    break;
+		    continue;
 		}
 #endif
 
@@ -278,7 +278,7 @@ char *do_browser(char *path, DIR *dir)
 			strerror(errno));
 		    beep();
 		    free(new_path);
-		    break;
+		    continue;
 		}
 
 		/* Start over again with the new path value. */
@@ -302,7 +302,7 @@ char *do_browser(char *path, DIR *dir)
 		if (strcmp(filelist[selected], "/..") == 0) {
 		    statusbar(_("Can't move up a directory"));
 		    beep();
-		    break;
+		    continue;
 		}
 
 #ifndef DISABLE_OPERATINGDIR
@@ -314,7 +314,7 @@ char *do_browser(char *path, DIR *dir)
 			_("Can't go outside of %s in restricted mode"),
 			operating_dir);
 		    beep();
-		    break;
+		    continue;
 		}
 #endif
 
@@ -324,7 +324,7 @@ char *do_browser(char *path, DIR *dir)
 		    statusbar(_("Error reading %s: %s"),
 			filelist[selected], strerror(errno));
 		    beep();
-		    break;
+		    continue;
 		}
 
 		/* If we've successfully opened a file, we're done, so
@@ -332,7 +332,7 @@ char *do_browser(char *path, DIR *dir)
 		if (!S_ISDIR(st.st_mode)) {
 		    retval = mallocstrcpy(NULL, filelist[selected]);
 		    abort = TRUE;
-		    break;
+		    continue;
 		/* If we've successfully opened a directory, and it's
 		 * "..", save the current directory in prev_dir, so that
 		 * we can select it later. */
@@ -347,7 +347,7 @@ char *do_browser(char *path, DIR *dir)
 		    statusbar(_("Error reading %s: %s"),
 			filelist[selected], strerror(errno));
 		    beep();
-		    break;
+		    continue;
 		}
 
 		path = mallocstrcpy(path, filelist[selected]);
diff --git a/src/global.c b/src/global.c
index 94991bf9..74260b0e 100644
--- a/src/global.c
+++ b/src/global.c
@@ -701,9 +701,9 @@ void shortcut_init(bool unjustify)
     add_to_funcs(DO_SEARCH, MMAIN|MBROWSER, whereis_msg,
 	IFSCHELP(nano_whereis_msg), FALSE, VIEW);
 
-    add_to_funcs(DO_PAGE_UP, MMAIN|MHELP,
+    add_to_funcs(DO_PAGE_UP, MMAIN|MHELP|MBROWSER,
 	prev_page_msg, IFSCHELP(nano_prevpage_msg), FALSE, VIEW);
-    add_to_funcs(DO_PAGE_DOWN, MMAIN|MHELP,
+    add_to_funcs(DO_PAGE_DOWN, MMAIN|MHELP|MBROWSER,
 	next_page_msg, IFSCHELP(nano_nextpage_msg), TRUE, VIEW);
 
 
@@ -792,12 +792,6 @@ void shortcut_init(bool unjustify)
 
 #endif
 
-    add_to_funcs(DO_PAGE_UP, MBROWSER,
-	prev_page_msg, IFSCHELP(nano_prevpage_msg), FALSE, VIEW);
-    add_to_funcs(DO_PAGE_DOWN, MBROWSER,
-	next_page_msg, IFSCHELP(nano_nextpage_msg), TRUE, VIEW);
-
-
     add_to_funcs(DO_RIGHT, (MMAIN|MBROWSER), N_("Forward"), IFSCHELP(nano_forward_msg),
 	FALSE, VIEW);
     add_to_funcs(DO_RIGHT, MALL, "", "", FALSE, VIEW);
@@ -1030,6 +1024,7 @@ void shortcut_init(bool unjustify)
     add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", DO_EXIT, 0, TRUE);
     add_to_sclist(MMAIN, "^_", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
     add_to_sclist(MMAIN, "F13", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
+    add_to_sclist(MMAIN, "M-G", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
     add_to_sclist(MMAIN, "^O", DO_WRITEOUT_VOID, 0, TRUE);
     add_to_sclist(MMAIN, "F3", DO_WRITEOUT_VOID, 0, TRUE);
 #ifndef DISABLE_JUSTIFY
@@ -1057,9 +1052,6 @@ void shortcut_init(bool unjustify)
     add_to_sclist(MMAIN, "^T", DO_SPELL, 0, TRUE);
     add_to_sclist(MMAIN, "F12", DO_SPELL, 0, TRUE);
 #endif
-    add_to_sclist(MMAIN, "^_", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
-    add_to_sclist(MMAIN, "F13", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
-    add_to_sclist(MMAIN, "M-G", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
     add_to_sclist(MMAIN, "^\\", DO_REPLACE, 0, TRUE);
     add_to_sclist(MMAIN, "F14", DO_REPLACE, 0, TRUE);
     add_to_sclist(MMAIN, "M-R", DO_REPLACE, 0, TRUE);
@@ -1137,6 +1129,9 @@ void shortcut_init(bool unjustify)
     add_to_sclist(MBROWSER|MWHEREISFILE, "M-|",  FIRST_FILE_MSG, 0, TRUE);
     add_to_sclist(MBROWSER|MWHEREISFILE, "M-/",  LAST_FILE_MSG, 0, TRUE);
     add_to_sclist(MBROWSER|MWHEREISFILE, "M-?",  LAST_FILE_MSG, 0, TRUE);
+    add_to_sclist(MBROWSER|MWHEREISFILE, "^_",  GOTO_DIR_MSG, 0, TRUE);
+    add_to_sclist(MBROWSER|MWHEREISFILE, "F13",  GOTO_DIR_MSG, 0, TRUE);
+    add_to_sclist(MBROWSER|MWHEREISFILE, "M-G",  GOTO_DIR_MSG, 0, TRUE);
 #ifndef NANO_TINY
     add_to_sclist(MMAIN, "M-]", DO_FIND_BRACKET, 0, TRUE);
     add_to_sclist(MMAIN, "M--", DO_SCROLL_UP, 0, TRUE);