mirror of
git://git.sv.gnu.org/nano.git
synced 2025-04-01 09:12:57 +03:00
Now putting things in the proper order: setting 'prev_dir' only when
we've actually succeeded in changing directory. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5677 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
761fa7cd3a
commit
3b8989b0a9
@ -1,6 +1,7 @@
|
|||||||
2016-02-25 Benno Schulenberg <bensberg@justemail.net>
|
2016-02-25 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/browser.c (do_browser): Plug a memory leak by not copying
|
* src/browser.c (do_browser): Plug a memory leak by not copying
|
||||||
a string twice. This fixes Savannah bug #47206.
|
a string twice. This fixes Savannah bug #47206.
|
||||||
|
* src/browser.c (do_browser): Now put things in the proper order.
|
||||||
|
|
||||||
2016-02-23 Benno Schulenberg <bensberg@justemail.net>
|
2016-02-23 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/prompt.c (do_statusbar_output, do_statusbar_delete):
|
* src/prompt.c (do_statusbar_output, do_statusbar_delete):
|
||||||
|
@ -318,24 +318,22 @@ char *do_browser(char *path, DIR *dir)
|
|||||||
* get out. */
|
* get out. */
|
||||||
retval = mallocstrcpy(NULL, filelist[selected]);
|
retval = mallocstrcpy(NULL, filelist[selected]);
|
||||||
break;
|
break;
|
||||||
} else if (strcmp(tail(filelist[selected]), "..") == 0)
|
}
|
||||||
/* We've successfully opened the parent directory,
|
|
||||||
* save the current directory in prev_dir, so that
|
|
||||||
* we can easily return to it by hitting Enter. */
|
|
||||||
prev_dir = striponedir(filelist[selected]);
|
|
||||||
|
|
||||||
dir = opendir(filelist[selected]);
|
dir = opendir(filelist[selected]);
|
||||||
|
|
||||||
if (dir == NULL) {
|
if (dir == NULL) {
|
||||||
/* We can't open this directory for some reason.
|
|
||||||
* Complain. */
|
|
||||||
statusbar(_("Error reading %s: %s"),
|
statusbar(_("Error reading %s: %s"),
|
||||||
filelist[selected], strerror(errno));
|
filelist[selected], strerror(errno));
|
||||||
free(prev_dir);
|
|
||||||
prev_dir = NULL;
|
|
||||||
beep();
|
beep();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If we moved up one level, remember where we came from, so
|
||||||
|
* this directory can be highlighted and easily reentered. */
|
||||||
|
if (strcmp(tail(filelist[selected]), "..") == 0)
|
||||||
|
prev_dir = striponedir(filelist[selected]);
|
||||||
|
|
||||||
path = mallocstrcpy(path, filelist[selected]);
|
path = mallocstrcpy(path, filelist[selected]);
|
||||||
|
|
||||||
/* Start over again with the new path value. */
|
/* Start over again with the new path value. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user