commit 60d22f012ab33c4b4735e63c9d53b6196f798b70
parent 2f7c1a061373dfb1bfb80ec96b75da9d7ae7ec67
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Wed, 5 Jul 2006 02:24:23 +0000
in do_browser() and do_help(), detect the previous selected file or
directory and the previous help text line properly again
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3742 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git 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
@@ -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