Limiting the selected file to the available ones in the list.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5273 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-06-28 06:32:56 +00:00
parent 954f98c448
commit 6062a040e1
2 changed files with 9 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2015-06-28 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (browser_refresh): Limit the selected file to the
available ones in the list -- after a refresh the number may have
decreased. This fixes Savannah bug #45424.
2015-06-27 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_undo, add_undo): Skip undoing a backspace *only* when
it really tried to delete the final, magic newline.

View File

@ -565,6 +565,10 @@ void browser_refresh(void)
browser_init(path_save, opendir(path_save));
qsort(filelist, filelist_len, sizeof(char *), diralphasort);
/* Make sure the selected file is within range. */
if (selected >= filelist_len)
selected = filelist_len - 1;
titlebar(path_save);
blank_edit();