file highlight after a "cd"
Egmont Koblinger
egmont at uhulinux.hu
Mon Oct 24 18:27:20 UTC 2005
> The attached patch fixes the following bug
2nd try, this time with an attachment :)
--
Egmont
-------------- next part --------------
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 at 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;
More information about the mc-devel
mailing list