zsh-users
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: Oliver Kiddle <okiddle@yahoo.co.uk>
Cc: Zsh users list <zsh-users@sunsite.dk>
Subject: PATCH: re-expand the prompt automatically
Date: Thu, 1 Jul 2004 09:44:46 -0700	[thread overview]
Message-ID: <20040701164446.GA22234@blorf.net> (raw)
In-Reply-To: <23265.1088685020@trentino.logica.co.uk>

[-- Attachment #1: Type: text/plain, Size: 538 bytes --]

On Thu, Jul 01, 2004 at 02:30:20PM +0200, Oliver Kiddle wrote:
> Is there any chance this could be automatically called before the
> prompt is reprinted when a background job finishes? That would allow %j
> prompt expansions to be right.

I had this same thought.  Here's a patch that makes the re-expanding
part of the new function get called from zrefresh().  If that turns out
to be too pervasive, we could mod_export the new reexpandprompt()
function and call it from various other places in the code, such as
from jobs.c.

..wayne..

[-- Attachment #2: prompting.patch --]
[-- Type: text/plain, Size: 1039 bytes --]

--- Src/Zle/zle_main.c	1 Jul 2004 14:55:58 -0000	1.46
+++ Src/Zle/zle_main.c	1 Jul 2004 16:42:30 -0000
@@ -1311,14 +1311,20 @@ recursiveedit(UNUSED(char **args))
 }
 
 /**/
-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);
 }
 
--- Src/Zle/zle_refresh.c	2 Jun 2004 22:15:02 -0000	1.12
+++ Src/Zle/zle_refresh.c	1 Jul 2004 16:42:30 -0000
@@ -291,7 +291,8 @@ zrefresh(void)
     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 */
-	
+
+    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  *

  reply	other threads:[~2004-07-01 16:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-01 11:23 Jumping to the line above Fabiano Sidler
2004-07-01 11:32 ` Peter Stephenson
2004-07-01 12:14   ` Peter Stephenson
2004-07-01 12:30     ` Oliver Kiddle
2004-07-01 16:44       ` Wayne Davison [this message]
2004-07-01 19:55     ` Fabiano Sidler
2004-07-01 23:45       ` Bart Schaefer

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=20040701164446.GA22234@blorf.net \
    --to=wayned@users.sourceforge.net \
    --cc=okiddle@yahoo.co.uk \
    --cc=zsh-users@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).