From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3159 invoked from network); 1 Jul 2004 16:45:50 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.85) by ns1.primenet.com.au with SMTP; 1 Jul 2004 16:45:50 -0000 Received: (qmail 31019 invoked from network); 1 Jul 2004 17:57:26 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Jul 2004 17:57:26 -0000 Received: (qmail 15251 invoked by alias); 1 Jul 2004 16:45:03 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7652 Received: (qmail 15225 invoked from network); 1 Jul 2004 16:45:01 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.85) by sunsite.dk with SMTP; 1 Jul 2004 16:45:01 -0000 Received: (qmail 30140 invoked from network); 1 Jul 2004 17:57:04 -0000 Received: from dsl3-63-249-88-2.cruzio.com (HELO binome.blorf.net) (63.249.88.2) by a.mx.sunsite.dk with SMTP; 1 Jul 2004 17:56:51 -0000 Received: by binome.blorf.net (Postfix, from userid 1000) id C454C9960; Thu, 1 Jul 2004 09:44:46 -0700 (PDT) Date: Thu, 1 Jul 2004 09:44:46 -0700 From: Wayne Davison To: Oliver Kiddle Cc: Zsh users list Subject: PATCH: re-expand the prompt automatically Message-ID: <20040701164446.GA22234@blorf.net> References: <200407011214.i61CEhUe012898@news01.csr.com> <23265.1088685020@trentino.logica.co.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="cWoXeonUoKmBZSoM" Content-Disposition: inline In-Reply-To: <23265.1088685020@trentino.logica.co.uk> User-Agent: Mutt/1.5.6+20040523i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-0.0 required=6.0 tests=BAYES_44 autolearn=no version=2.63 X-Spam-Hits: -0.0 --cWoXeonUoKmBZSoM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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.. --cWoXeonUoKmBZSoM Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="prompting.patch" --- 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 * --cWoXeonUoKmBZSoM--