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

PATCH: 4.0.2: rprompt2 variable



Even if a feature (right-hand prompts) is frivolous, it might as well be
available in general.

Now you can see the parser state (or whatever else you might want to put
in PROMPT2) and still have a consistent left margin when entering a multi-
line command.  See my companion "reverse parser state" patch if you want
the parser state to expand leftward on your screen.

Comments welcome (I just started using zsh and I have no idea if anyone
else will find these patches useful).

-- Derek




--- Src/params.c.orig	Thu Jan 24 15:23:36 2002
+++ Src/params.c	Thu Jan 24 18:33:52 2002
@@ -65,6 +65,7 @@
      *prompt4,		/* $PROMPT4     */
      *readnullcmd,	/* $READNULLCMD */
      *rprompt,		/* $RPROMPT     */
+     *rprompt2,		/* $RPROMPT2    */
      *sprompt,		/* $SPROMPT     */
      *wordchars,	/* $WORDCHARS   */
      *zsh_name;		/* $ZSH_NAME    */
@@ -193,12 +194,14 @@
 IPDEF7("NULLCMD", &nullcmd),
 IPDEF7("POSTEDIT", &postedit),
 IPDEF7("READNULLCMD", &readnullcmd),
-IPDEF7("RPROMPT", &rprompt),
 IPDEF7("PS1", &prompt),
+IPDEF7("RPS1", &rprompt),
+IPDEF7("RPROMPT", &rprompt),
 IPDEF7("PS2", &prompt2),
+IPDEF7("RPS2", &rprompt2),
+IPDEF7("RPROMPT2", &rprompt2),
 IPDEF7("PS3", &prompt3),
 IPDEF7("PS4", &prompt4),
-IPDEF7("RPS1", &rprompt),
 IPDEF7("SPROMPT", &sprompt),
 IPDEF7("0", &argzero),
 
--- Src/input.c.orig	Thu Jan 24 15:38:18 2002
+++ Src/input.c	Thu Jan 24 18:33:53 2002
@@ -222,8 +222,11 @@
 
     /* If reading code interactively, work out the prompts. */
     if (interact && isset(SHINSTDIN)) {
-	if (!isfirstln)
+	if (!isfirstln) {
 	    ingetcpmptl = prompt2;
+	    if (rprompt2)
+		ingetcpmptr = rprompt2;
+	}
 	else {
 	    ingetcpmptl = prompt;
 	    if (rprompt)
--- Doc/Zsh/params.yo.orig	Thu Jan 24 19:33:03 2002
+++ Doc/Zsh/params.yo	Thu Jan 24 19:34:34 2002
@@ -955,6 +955,15 @@
 This does not work if the tt(SINGLELINEZLE) option is set.
 It is expanded in the same way as tt(PS1).
 )
+vindex(RPROMPT2)
+xitem(tt(RPROMPT2) <S>)
+vindex(RPS2)
+item(tt(RPS2) <S>)(
+This prompt is displayed on the right-hand side of the screen
+when the secondary prompt is being displayed on the left.
+This does not work if the tt(SINGLELINEZLE) option is set.
+It is expanded in the same way as tt(PS2).
+)
 vindex(SAVEHIST)
 item(tt(SAVEHIST))(
 The maximum number of history events to save in the history file.



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