- Remove unneeded call to blank_edit(). (DLR)
- After entering "..", select the directory we were in before
instead of the first filename in the list, as Pico does. (DLR)
+ - Display an error messsage on the statusbar if we try to move
+ up from "/" via the "Go to Directory" prompt, for consistency.
+ (DLR)
browser_refresh()
- Simplify. (DLR)
- Fix problems where translated versions of "(dir)" could be
int i;
size_t fileline;
char *new_path;
- /* Used by the "Go To Directory" prompt. */
+ size_t new_path_len;
/* Compute the line number we're on now, so that we don't divide
* by zero. */
ans = mallocstrcpy(ans, "");
new_path = real_dir_from_tilde(answer);
+ new_path_len = strlen(new_path) + 1;
if (new_path[0] != '/') {
new_path = charealloc(new_path, strlen(path) +
sprintf(new_path, "%s%s", path, answer);
}
+ if (new_path[new_path_len - 1] == '/')
+ null_at(&new_path, new_path_len - 1);
+
+ /* We can't move up from "/". */
+ if (strcmp(new_path, "/..") == 0) {
+ statusbar(_("Can't move up a directory"));
+ beep();
+ break;
+ }
+
#ifndef DISABLE_OPERATINGDIR
if (check_operating_dir(new_path, FALSE)) {
statusbar(