From c457eaf9b152180f5ce462481146a16a9b19722d Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 11 Apr 2012 21:38:07 +0400 Subject: [PATCH] Ticket #2776: file selection reset after exit from the archive in the root. After exit from archive located in the root of FS, file selection is reset (/bin is selected instead of the archive). Signed-off-by: Andrew Borodin --- src/filemanager/panel.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c index 824a587ce..9d6dc22b5 100644 --- a/src/filemanager/panel.c +++ b/src/filemanager/panel.c @@ -2980,10 +2980,15 @@ get_parent_dir_name (const char *cwd, const char *lwd) return NULL; } - while (--p > lwd && *p != PATH_SEP); - while (--p > lwd && *p != PATH_SEP); + /* skip VFS prefix */ + while (--p > lwd && *p != PATH_SEP) + ; + /* get last component */ + while (--p > lwd && *p != PATH_SEP) + ; - return (p != lwd) ? p + 1 : NULL; + /* return last component */ + return (*p == PATH_SEP) ? p + 1 : p; } /* --------------------------------------------------------------------------------------------- */