diff --git a/src/browser.c b/src/browser.c
index 45d9bfdec321a42ab9c8783f2af12f971c774d49..2183d43312e64db1a06b512e65d5d1b547508e8a 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -58,6 +58,8 @@ char *do_browser(char *path, DIR *dir)
 	 * browsing to "..". */
     char *ans = mallocstrcpy(NULL, "");
 	/* The last answer the user typed on the statusbar. */
+    size_t old_selected;
+	/* The selected file we had before the current selected file. */
 
     curs_set(0);
     blank_statusbar();
@@ -98,6 +100,8 @@ char *do_browser(char *path, DIR *dir)
     } else
 	selected = 0;
 
+    old_selected = (size_t)-1;
+
     titlebar(path);
 
     while (!abort) {
@@ -105,9 +109,6 @@ char *do_browser(char *path, DIR *dir)
 	int i;
 	size_t fileline = selected / width;
 		/* The line number the selected file is on. */
-	size_t old_selected = (size_t)-1;
-		/* The selected file we had before the current selected
-		 * file. */
 	char *new_path;
 		/* The path we switch to at the "Go to Directory"
 		 * prompt. */
@@ -117,6 +118,8 @@ char *do_browser(char *path, DIR *dir)
 	if (kbinput == ERR || old_selected != selected)
 	    browser_refresh();
 
+	old_selected = selected;
+
 	kbinput = get_kbinput(edit, &meta_key, &func_key);
 	parse_browser_input(&kbinput, &meta_key, &func_key);
 
@@ -358,8 +361,6 @@ char *do_browser(char *path, DIR *dir)
 		abort = TRUE;
 		break;
 	}
-
-	old_selected = selected;
     }
 
     titlebar(NULL);
diff --git a/src/help.c b/src/help.c
index 049ea07f1e344eb21234a33588b795f7b7def685..2597efb7f309e853ecea75ab7b9bc4b475268c6f 100644
--- a/src/help.c
+++ b/src/help.c
@@ -51,6 +51,9 @@ void do_help(void (*refresh_func)(void))
 	/* The current shortcut list. */
 #endif
     const char *ptr;
+	/* The current line of help text. */
+    size_t old_line = (size_t)-1;
+	/* The line we were on before the current line. */
 
     curs_set(0);
     blank_edit();
@@ -90,9 +93,6 @@ void do_help(void (*refresh_func)(void))
 
     while (!abort) {
 	size_t i;
-	    /* Generic loop variable. */
-	size_t old_line = (size_t)-1;
-	    /* The line we were on before the current line. */
 
 	/* Display the help text if we don't have a key, or if the help
 	 * text has moved. */
@@ -121,6 +121,8 @@ void do_help(void (*refresh_func)(void))
 
 	wnoutrefresh(edit);
 
+	old_line = line;
+
 	kbinput = get_kbinput(edit, &meta_key, &func_key);
 	parse_help_input(&kbinput, &meta_key, &func_key);
 
@@ -171,8 +173,6 @@ void do_help(void (*refresh_func)(void))
 		abort = TRUE;
 		break;
 	}
-
-	old_line = line;
     }
 
 #ifndef DISABLE_MOUSE