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
This commit is contained in:
David Lawrence Ramsey 2006-07-05 02:24:23 +00:00
parent 2f7c1a0613
commit 60d22f012a
2 changed files with 11 additions and 10 deletions

View File

@ -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);

View File

@ -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