Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Long directories in prompt



-----BEGIN PGP SIGNED MESSAGE-----

Zoltan's fix broke prompt truncation.

 -zefram

      *** Src/prompt.c	1996/12/30 14:14:18	1.2
      --- Src/prompt.c	1996/12/30 14:47:46
      ***************
      *** 293,301 ****
        	    switch (*fm) {
        	    case '~':
        		if ((nd = finddir(pwd))) {
      ! 		    stradd("~");
      ! 		    stradd(nd->nam);
      ! 		    stradd(pwd + strlen(nd->dir));
        		    break;
        		}
        	    case 'd':
      --- 293,301 ----
        	    switch (*fm) {
        	    case '~':
        		if ((nd = finddir(pwd))) {
      ! 		    char *t = tricat("~", nd->nam, pwd + strlen(nd->dir));
      ! 		    stradd(t);
      ! 		    zsfree(t);
        		    break;
        		}
        	    case 'd':
      ***************
      *** 308,316 ****
        		    char *t;
        
        		    if ((nd = finddir(pwd)))
      ! 			t = pwd + strlen(nd->dir);
        		    else
      ! 			t = pwd;
        		    if (!arg)
        			arg++;
        		    for (ss = t + strlen(t); ss > t; ss--)
      --- 308,316 ----
        		    char *t;
        
        		    if ((nd = finddir(pwd)))
      ! 			t = tricat("~", nd->nam, pwd + strlen(nd->dir));
        		    else
      ! 			t = ztrdup(pwd);
        		    if (!arg)
        			arg++;
        		    for (ss = t + strlen(t); ss > t; ss--)
      ***************
      *** 318,329 ****
        			    ss++;
        			    break;
        			}
      ! 		    if (nd && ss == t && (*ss != '/' || arg > 1)) {
      ! 			stradd("~");
      ! 			stradd(nd->nam);
      ! 		    } else if (*ss == '/' && ss[1] && (ss != pwd))
        			ss++;
        		    stradd(ss);
        		    break;
        		}
        	    case 'C':
      --- 318,327 ----
        			    ss++;
        			    break;
        			}
      ! 		    if(*ss == '/' && ss[1] && ss != t)
        			ss++;
        		    stradd(ss);
      + 		    zsfree(t);
        		    break;
        		}
        	    case 'C':

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMsfXbnD/+HJTpU/hAQHrdAP+OoJD1x42fqkg47HY1/NjEqbXDsIlpqo/
pVAim1JjUdG70FHBNpMU5+k+r3raC9mki3Tqthj3/taVf95rkpOubLzEEx+4RocG
TSSe/UVnqTHxJdSR62UM63EciL+sximv04EUh0erLz0jJQzQoAwc8sl9uehe9s0W
t3j1JOjaWoQ=
=2/CR
-----END PGP SIGNATURE-----



Messages sorted by: Reverse Date, Date, Thread, Author