From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21302 invoked from network); 1 Jul 2004 12:16:14 -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 12:16:14 -0000 Received: (qmail 5827 invoked from network); 1 Jul 2004 13:27:36 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Jul 2004 13:27:36 -0000 Received: (qmail 28020 invoked by alias); 1 Jul 2004 12:15:20 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7650 Received: (qmail 28011 invoked from network); 1 Jul 2004 12:15:20 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.85) by sunsite.dk with SMTP; 1 Jul 2004 12:15:20 -0000 Received: (qmail 4792 invoked from network); 1 Jul 2004 13:27:15 -0000 Received: from lhuumrelay3.lnd.ops.eu.uu.net (62.189.58.19) by a.mx.sunsite.dk with SMTP; 1 Jul 2004 13:27:07 -0000 Received: from MAILSWEEPER01.csr.com (mailhost1.csr.com [62.189.183.235]) by lhuumrelay3.lnd.ops.eu.uu.net (8.11.0/8.11.0) with ESMTP id i61CEiv21884 for ; Thu, 1 Jul 2004 12:14:44 GMT Received: from EXCHANGE02.csr.com (unverified [192.168.137.45]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Thu, 1 Jul 2004 13:14:04 +0100 Received: from news01.csr.com ([192.168.143.38]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 1 Jul 2004 13:15:26 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.12.11/8.12.11) with ESMTP id i61CEhkO012901 for ; Thu, 1 Jul 2004 13:14:43 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.12.11/8.12.11/Submit) with ESMTP id i61CEhUe012898 for ; Thu, 1 Jul 2004 13:14:43 +0100 Message-Id: <200407011214.i61CEhUe012898@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-users@sunsite.dk (Zsh users list) Subject: Re: Jumping to the line above In-reply-to: "Peter Stephenson"'s message of "Thu, 01 Jul 2004 12:32:08 BST." <200407011132.i61BW9Ss012116@news01.csr.com> Date: Thu, 01 Jul 2004 13:14:42 +0100 From: Peter Stephenson X-OriginalArrivalTime: 01 Jul 2004 12:15:26.0410 (UTC) FILETIME=[178452A0:01C45F65] 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_50 autolearn=no version=2.63 X-Spam-Hits: 0.0 Peter Stephenson wrote: > > [Some previous output] > > ~/bin/foo/bar $ > > > > After typing (for example) ^U twice: > > > > [Some previous output] > > ~/bin $ > > I think what you *really* want is a way of re-expanding the current > prompt. This may be oversimple (in particular, I have no idea what to do about pmpt_attr and rpmpt_attr) ... Further followups on that should go to zsh-workers. After the patch, you can do stuff like PS1="%~%# " zle-pushd() { emulate -L zsh setopt pushdsilent # Use the numeric argument to get a new directory. # Make sure we get an argument in the +/- from expected by pushd. local numeric=${NUMERIC:-+1} [[ $numeric = [-+]* ]] || numeric="+$numeric" pushd $numeric zle reset-prompt } zle -N zle-pushd bindkey '^x^p' zle-pushd Index: Doc/Zsh/zle.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/zle.yo,v retrieving revision 1.35 diff -u -r1.35 zle.yo --- Doc/Zsh/zle.yo 22 Jun 2004 07:02:50 -0000 1.35 +++ Doc/Zsh/zle.yo 1 Jul 2004 12:03:19 -0000 @@ -1737,6 +1737,15 @@ item(tt(redisplay) (unbound) (^R) (^R))( Redisplays the edit buffer. ) +tindex(reset-prompt) +item(tt(reset-prompt) (unbound) (unbound) (unbound))( +Force the prompts on both the left and right of the screen to be +re-expanded, then redisplay the edit buffer. Note that this +does not reflect changes to the prompt variables themselves, only changes +in the expansion of the values (for example, changes in time or +directory, or changes to the value of variables referred to by the +prompt). +) tindex(send-break) item(tt(send-break) (^G ESC-^G) (unbound) (unbound))( Abort the current editor function, e.g. tt(execute-named-command), or the Index: Src/Zle/iwidgets.list =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/iwidgets.list,v retrieving revision 1.5 diff -u -r1.5 iwidgets.list --- Src/Zle/iwidgets.list 20 Feb 2004 15:27:53 -0000 1.5 +++ Src/Zle/iwidgets.list 1 Jul 2004 12:03:19 -0000 @@ -88,6 +88,7 @@ "recursive-edit", recursiveedit, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL "redisplay", redisplay, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL "redo", redo, ZLE_KEEPSUFFIX +"reset-prompt", resetprompt, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL "reverse-menu-complete", reversemenucomplete, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_ISCOMP "run-help", processcmd, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL "self-insert", selfinsert, ZLE_MENUCMP | ZLE_KEEPSUFFIX Index: Src/Zle/zle_main.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v retrieving revision 1.45 diff -u -r1.45 zle_main.c --- Src/Zle/zle_main.c 2 Jun 2004 22:15:01 -0000 1.45 +++ Src/Zle/zle_main.c 1 Jul 2004 12:03:20 -0000 @@ -150,6 +150,8 @@ /**/ mod_export char *zlenoargs[1] = { NULL }; +static char *raw_lp, *raw_rp; + #ifdef FIONREAD static int delayzsetterm; #endif @@ -785,8 +787,10 @@ insmode = unset(OVERSTRIKE); eofsent = 0; resetneeded = 0; + raw_lp = lp; lpromptbuf = promptexpand(lp, 1, NULL, NULL); pmpt_attr = txtchange; + raw_rp = rp; rpromptbuf = promptexpand(rp, 1, NULL, NULL); rpmpt_attr = txtchange; free_prepostdisplay(); @@ -1307,6 +1311,18 @@ } /**/ +int +resetprompt(UNUSED(char **args)) +{ + free(lpromptbuf); + lpromptbuf = promptexpand(raw_lp, 1, NULL, NULL); + free(rpromptbuf); + rpromptbuf = promptexpand(raw_rp, 1, NULL, NULL); + + return redisplay(NULL); +} + +/**/ mod_export void trashzle(void) { -- Peter Stephenson 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 **********************************************************************