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

PATCH: %y modifier in prompt substitution RE: %l prompt expansion change



>
> One solution might be to restore the old %l behavior and put the new,
> consistent tty-output behavior onto a new expansion, like %y, perhaps.
>

I hope this suites everybody ...

-andrej

BTW the list of characters in prompt subst manual is hopelessly out of
order.

Index: Src/prompt.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/prompt.c,v
retrieving revision 1.6
diff -u -r1.6 prompt.c
--- Src/prompt.c        2001/06/06 16:38:50     1.6
+++ Src/prompt.c        2001/06/21 09:45:33
@@ -515,6 +515,14 @@
                break;
            case 'l':
                if (*ttystrname) {
+                   ss = (strncmp(ttystrname, "/dev/tty", 8) ?
+                           ttystrname + 5 : ttystrname + 8);
+                   stradd(ss);
+               } else
+                   stradd("()");
+               break;
+           case 'y':
+               if (*ttystrname) {
                    ss = (strncmp(ttystrname, "/dev/", 5) ?
                            ttystrname : ttystrname + 5);
                    stradd(ss);
Index: Doc/Zsh/prompt.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/prompt.yo,v
retrieving revision 1.3
diff -u -r1.3 prompt.yo
--- Doc/Zsh/prompt.yo   2000/07/13 11:20:46     1.3
+++ Doc/Zsh/prompt.yo   2001/06/21 09:45:34
@@ -120,7 +120,12 @@
 (24/12 hour clock) in the same way.
 )
 item(tt(%l))(
-The line (tty) the user is logged in on.
+The line (tty) the user is logged in on without tt(/dev/) prefix.
+If name starts with tt(/dev/tty) this is stripped.
+)
+item(tt(%y))(
+The line (tty) the user is logged in on without tt(/dev/) prefix.
+It does not treat tt(/dev/tty*) specially.
 )
 item(tt(%?))(
 The return code of the last command executed just before the prompt.



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