From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9880 invoked from network); 17 May 2009 04:56:02 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 17 May 2009 04:56:02 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 43638 invoked from network); 17 May 2009 04:55:58 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 May 2009 04:55:58 -0000 Received: (qmail 10817 invoked by alias); 17 May 2009 04:55:54 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26964 Received: (qmail 10805 invoked from network); 17 May 2009 04:55:53 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 17 May 2009 04:55:53 -0000 Received: from QMTA10.westchester.pa.mail.comcast.net (qmta10.westchester.pa.mail.comcast.net [76.96.62.17]) by bifrost.dotsrc.org (Postfix) with ESMTP id 0520A80271EA for ; Sun, 17 May 2009 06:55:37 +0200 (CEST) Received: from OMTA14.westchester.pa.mail.comcast.net ([76.96.62.60]) by QMTA10.westchester.pa.mail.comcast.net with comcast id sUqk1b0051HzFnQ5AUved2; Sun, 17 May 2009 04:55:38 +0000 Received: from smtp.klanderman.net ([98.217.254.247]) by OMTA14.westchester.pa.mail.comcast.net with comcast id sUvc1b00K5M2Np63aUvcGW; Sun, 17 May 2009 04:55:38 +0000 Received: from lwm.klanderman.net (unknown [192.168.100.50]) by smtp.klanderman.net (Postfix) with ESMTP id 5600BB30147; Sun, 17 May 2009 00:55:35 -0400 (EDT) Received: by lwm.klanderman.net (Postfix, from userid 500) id 389A69FC61B; Sun, 17 May 2009 00:55:35 -0400 (EDT) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="npU4t4opwN" Content-Transfer-Encoding: 7bit Message-ID: <18959.39111.181251.865306@gargle.gargle.HOWL> Date: Sun, 17 May 2009 00:55:35 -0400 From: Greg Klanderman To: Zsh list Subject: PATCH: make PROMPT_SP end-of-line marker configurable Reply-To: gak@klanderman.net X-Mailer: VM 7.17 under 21.4 (patch 17) "Jumbo Shrimp" XEmacs Lucid X-Virus-Scanned: ClamAV 0.94.2/9365/Sat May 16 14:41:29 2009 on bifrost X-Virus-Status: Clean --npU4t4opwN Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit Hi, This adds a parameter, EOLMARK, which allows configuring the end-of-line marker used by the PROMPT_SP option. I also cleaned up the doc for PS1 slightly. thanks, Greg --npU4t4opwN Content-Type: text/plain Content-Disposition: inline; filename="zsh-EOLMARK.patch" Content-Transfer-Encoding: 7bit Index: Src/utils.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/utils.c,v retrieving revision 1.221 diff -u -r1.221 utils.c --- Src/utils.c 6 Apr 2009 09:06:36 -0000 1.221 +++ Src/utils.c 17 May 2009 04:31:42 -0000 @@ -1216,12 +1216,16 @@ * Unfortunately it interacts badly with ZLE displaying message * when ^D has been pressed. So just disable PROMPT_SP logic in * this case */ + char *eolmark = getsparam("EOLMARK"); char *str; - int percents = opts[PROMPTPERCENT]; + int percents = opts[PROMPTPERCENT], w = 0; + if (!eolmark || !*eolmark) + eolmark = "%B%S%#%s%b"; opts[PROMPTPERCENT] = 1; - str = promptexpand("%B%S%#%s%b", 0, NULL, NULL, NULL); + str = promptexpand(eolmark, 1, NULL, NULL, NULL); + countprompt(str, &w, 0, -1); opts[PROMPTPERCENT] = percents; - fprintf(shout, "%s%*s\r", str, (int)columns - 1 - !hasxn, ""); + fprintf(shout, "%s%*s\r", str, (int)columns - w - !hasxn, ""); free(str); } Index: Doc/Zsh/options.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v retrieving revision 1.81 diff -u -r1.81 options.yo --- Doc/Zsh/options.yo 6 Apr 2009 09:06:36 -0000 1.81 +++ Doc/Zsh/options.yo 17 May 2009 04:31:42 -0000 @@ -1307,16 +1307,18 @@ item(tt(PROMPT_SP) )( Attempt to preserve a partial line (i.e. a line that did not end with a newline) that would otherwise be covered up by the command prompt due to -the PROMPT_CR option. This works by outputting some cursor-control +the tt(PROMPT_CR) option. This works by outputting some cursor-control characters, including a series of spaces, that should make the terminal wrap to the next line when a partial line is present (note that this is only successful if your terminal has automatic margins, which is typical). -When a partial line is preserved, you will see an inverse+bold character at -the end of the partial line: a "%" for a normal user or a "#" for root. +When a partial line is preserved, by default you will see an inverse+bold +character at the end of the partial line: a "%" for a normal user or +a "#" for root. If set, the shell parameter tt(EOLMARK) can be used to +customize how the end of partial lines are shown. -NOTE: if the PROMPT_CR option is not set, enabling this option will have no -effect. This option is on by default. +NOTE: if the tt(PROMPT_CR) option is not set, enabling this option will +have no effect. This option is on by default. ) pindex(PROMPT_PERCENT) pindex(NO_PROMPT_PERCENT) Index: Doc/Zsh/params.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/params.yo,v retrieving revision 1.54 diff -u -r1.54 params.yo --- Doc/Zsh/params.yo 24 Apr 2009 09:00:37 -0000 1.54 +++ Doc/Zsh/params.yo 17 May 2009 04:31:42 -0000 @@ -823,6 +823,14 @@ arithmetic expansion before being interpreted as a pathname. Note that tt(ENV) is em(not) used unless zsh is emulating bf(sh) or bf(ksh). ) +vindex(EOLMARK) +item(tt(EOLMARK))( +When the tt(PROMPT_CR) and tt(PROMPT_SP) options are set, the tt(EOLMARK) +parameter can be used to customize how the end of partial lines are shown. +This parameter undergoes prompt expansion, with the tt(PROMPT_PERCENT) +option set. If not set or empty, the default behavior is equivalent to +the value `tt(%B%S%#%s%b)'. +) vindex(FCEDIT) item(tt(FCEDIT))( The default editor for the tt(fc) builtin. If tt(FCEDIT) is not set, @@ -1046,10 +1054,10 @@ vindex(PS1) item(tt(PS1) )( The primary prompt string, printed before a command is read. -the default is `tt(%m%# )'. It undergoes a special form of expansion +It undergoes a special form of expansion before being displayed; see ifzman(EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\ -ifnzman(noderef(Prompt Expansion)). +ifnzman(noderef(Prompt Expansion)). The default is `tt(%m%# )'. ) vindex(PS2) item(tt(PS2) )( --npU4t4opwN--