Re: file highlight after a "cd"



> The attached patch fixes the following bug

2nd try, this time with an attachment :)


-- 
Egmont
diff -Naurdp mc-4.6.1.orig/src/main.c mc-4.6.1/src/main.c
--- mc-4.6.1.orig/src/main.c	2005-07-23 18:52:02.000000000 +0200
+++ mc-4.6.1/src/main.c	2005-10-24 20:00:00.000000000 +0200
@@ -540,7 +540,6 @@ directory_history_add (struct WPanel *pa
 /*
  *  If we moved to the parent directory move the selection pointer to
  *  the old directory name; If we leave VFS dir, remove FS specificator.
- *  Warn: This code spoils lwd string.
  *
  *  You do _NOT_ want to add any vfs aware code here. <pavel ucw cz>
  */
@@ -549,7 +548,8 @@ get_parent_dir_name (const char *cwd, co
 {
     const char *p;
     if (strlen (lwd) > strlen (cwd))
-	if ((p = strrchr (lwd, PATH_SEP)) && !strncmp (cwd, lwd, p - lwd)) {
+	if ((p = strrchr (lwd, PATH_SEP)) && !strncmp (cwd, lwd, p - lwd) &&
+	 (strlen (cwd) == p - lwd || (p == lwd && cwd[0] == PATH_SEP && cwd[1] == '\0'))) {
 	    return (p + 1);
 	}
     return NULL;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]