zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: PATCH: re-expand the prompt automatically
Date: Fri, 02 Jul 2004 16:23:23 +0100	[thread overview]
Message-ID: <200407021523.i62FNNrh002531@news01.csr.com> (raw)
In-Reply-To: "Wayne Davison"'s message of "Thu, 01 Jul 2004 09:44:46 PDT." <20040701164446.GA22234@blorf.net>

Here's the tweak I just proposed to Wayne's patch: the only difference
is the `if (trashedzle)', plus the patch to the documentation.  If the
test succeeds we know the command line will be completely reprinted, so
this should do nicely what we want.

Index: Src/Zle/zle_main.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v
retrieving revision 1.46
diff -u -r1.46 zle_main.c
--- Src/Zle/zle_main.c	1 Jul 2004 14:55:58 -0000	1.46
+++ Src/Zle/zle_main.c	2 Jul 2004 15:22:34 -0000
@@ -1311,14 +1311,20 @@
 }
 
 /**/
-int
-resetprompt(UNUSED(char **args))
+void
+reexpandprompt(void)
 {
     free(lpromptbuf);
     lpromptbuf = promptexpand(raw_lp, 1, NULL, NULL);
     free(rpromptbuf);
     rpromptbuf = promptexpand(raw_rp, 1, NULL, NULL);
+}
 
+/**/
+int
+resetprompt(UNUSED(char **args))
+{
+    reexpandprompt();
     return redisplay(NULL);
 }
 
Index: Src/Zle/zle_refresh.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_refresh.c,v
retrieving revision 1.12
diff -u -r1.12 zle_refresh.c
--- Src/Zle/zle_refresh.c	2 Jun 2004 22:15:02 -0000	1.12
+++ Src/Zle/zle_refresh.c	2 Jul 2004 15:22:35 -0000
@@ -291,7 +291,9 @@
     unsigned char *tmpline;	/* line with added pre/post text */
     int tmpcs, tmpll;		/* ditto cursor position and line length */
     int tmpalloced;		/* flag to free tmpline when finished */
-	
+
+    if (trashedzle)
+	reexpandprompt();
 
     /* If this is called from listmatches() (indirectly via trashzle()), and *
      * that was called from the end of zrefresh(), then we don't need to do  *


-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


       reply	other threads:[~2004-07-02 15:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20040701164446.GA22234@blorf.net>
2004-07-02 15:23 ` Peter Stephenson [this message]
2004-07-02 21:06   ` Bart Schaefer
2004-07-04 17:17     ` Peter Stephenson
2004-07-04 21:38       ` Bart Schaefer
2004-07-05  9:26         ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200407021523.i62FNNrh002531@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).