From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18705 invoked from network); 16 Oct 2001 05:27:09 -0000 Received: from unknown (HELO sunsite.dk) (130.225.247.90) by ns1.primenet.com.au with SMTP; 16 Oct 2001 05:27:09 -0000 Received: (qmail 25264 invoked by alias); 16 Oct 2001 05:26:55 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16063 Received: (qmail 25087 invoked from network); 16 Oct 2001 05:26:49 -0000 Date: Tue, 16 Oct 2001 15:26:40 +1000 From: Geoff Wing To: Zsh Hackers Subject: PATCH: Re: Clearing RPS1: Is there a better way to do this? Message-ID: <20011016152640.A18535@primenet.com.au> References: <20011015145302.A5483@primenet.com.au> <1011015171102.ZM8325@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <1011015171102.ZM8325@candle.brasslantern.com>; from schaefer@brasslantern.com on Mon, Oct 15, 2001 at 05:11:15PM +0000 Organization: PrimeNet Computer Consultancy Bart Schaefer typed: :`setopt TRANSIENT_RPROMPT', perhaps? No docs yet. Also, RPROMPT won't disappear after positive response to > LISTMAX type questions. If this works OK for people (especially those who use ALWAYS_LAST_PROMPT (I don't)), I'll get some docs together for it. Regards, Geoff Index: options.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/options.c,v retrieving revision 1.10 diff -u -r1.10 options.c --- options.c 2001/06/27 11:22:05 1.10 +++ options.c 2001/10/16 05:10:51 @@ -199,6 +199,7 @@ {NULL, "singlecommand", OPT_SPECIAL, SINGLECOMMAND}, {NULL, "singlelinezle", OPT_KSH, SINGLELINEZLE}, {NULL, "sunkeyboardhack", 0, SUNKEYBOARDHACK}, +{NULL, "transientrprompt", 0, TRANSIENTRPROMPT}, {NULL, "unset", OPT_EMULATE|OPT_BSHELL, UNSET}, {NULL, "verbose", 0, VERBOSE}, {NULL, "xtrace", 0, XTRACE}, Index: zsh.h =================================================================== RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v retrieving revision 1.33 diff -u -r1.33 zsh.h --- zsh.h 2001/07/06 18:33:59 1.33 +++ zsh.h 2001/10/16 05:10:53 @@ -1439,6 +1439,7 @@ SINGLECOMMAND, SINGLELINEZLE, SUNKEYBOARDHACK, + TRANSIENTRPROMPT, UNSET, VERBOSE, XTRACE, Index: Zle/zle_main.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v retrieving revision 1.20 diff -u -r1.20 zle_main.c --- Zle/zle_main.c 2001/09/03 01:39:20 1.20 +++ Zle/zle_main.c 2001/10/16 05:10:54 @@ -1057,6 +1057,7 @@ * extra `inlist' check]). */ int sl = showinglist; showinglist = 0; + trashedzle = 1; zrefresh(); showinglist = sl; moveto(nlnct, 0); Index: Zle/zle_refresh.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_refresh.c,v retrieving revision 1.3 diff -u -r1.3 zle_refresh.c --- Zle/zle_refresh.c 2001/08/15 15:17:42 1.3 +++ Zle/zle_refresh.c 2001/10/16 05:10:55 @@ -76,6 +76,11 @@ /**/ mod_export int clearlist; +/* Zle in trashed state - updates may be subtly altered */ + +/**/ +int trashedzle; + #ifdef HAVE_SELECT /* cost of last update */ /**/ @@ -167,6 +172,7 @@ olnct = nlnct = 0; if (showinglist > 0) showinglist = -2; + trashedzle = 0; } /* @@ -357,6 +363,20 @@ zputs(lpromptbuf, shout); if (lpromptwof == winw) zputs("\n", shout); /* works with both hasam and !hasam */ + } else { + txtchange = pmpt_attr; + if (txtchangeisset(TXTNOBOLDFACE)) + tsetcap(TCALLATTRSOFF, 0); + if (txtchangeisset(TXTNOSTANDOUT)) + tsetcap(TCSTANDOUTEND, 0); + if (txtchangeisset(TXTNOUNDERLINE)) + tsetcap(TCUNDERLINEEND, 0); + if (txtchangeisset(TXTBOLDFACE)) + tsetcap(TCBOLDFACEBEG, 0); + if (txtchangeisset(TXTSTANDOUT)) + tsetcap(TCSTANDOUTBEG, 0); + if (txtchangeisset(TXTUNDERLINE)) + tsetcap(TCUNDERLINEBEG, 0); } if (clearflag) { zputc('\r', shout); @@ -504,11 +524,14 @@ zfree(nbuf[ln], winw + 2), nbuf[ln] = NULL; /* determine whether the right-prompt exists and can fit on the screen */ - if (!more_start) - put_rpmpt = rprompth == 1 && rpromptbuf[0] && - !strchr(rpromptbuf, '\t') && - (int)strlen(nbuf[0]) + rpromptw < winw - 1; - else { + if (!more_start) { + if (trashedzle && opts[TRANSIENTRPROMPT]) + put_rpmpt = 0; + else + put_rpmpt = rprompth == 1 && rpromptbuf[0] && + !strchr(rpromptbuf, '\t') && + (int)strlen(nbuf[0]) + rpromptw < winw - 1; + } else { /* insert >.... on first line if there is more text before start of screen */ memset(nbuf[0], ' ', lpromptw); t0 = winw - lpromptw; @@ -518,7 +541,7 @@ nbuf[0][winw] = nbuf[0][winw + 1] = '\0'; } - for (ln = 0; !clearf && (ln < nlnct); ln++) { + for (ln = 0; ln < nlnct; ln++) { /* if we have more lines than last time, clear the newly-used lines */ if (ln >= olnct) cleareol = 1; @@ -526,7 +549,7 @@ /* if old line and new line are different, see if we can insert/delete a line to speed up update */ - if (ln > 0 && ln < olnct - 1 && !(hasam && vcs == winw) && + if (!clearf && ln > 0 && ln < olnct - 1 && !(hasam && vcs == winw) && nbuf[ln] && obuf[ln] && strncmp(nbuf[ln], obuf[ln], 16)) { if (tccan(TCDELLINE) && obuf[ln + 1] && obuf[ln + 1][0] && @@ -558,6 +581,7 @@ /* output the right-prompt if appropriate */ if (put_rpmpt && !ln && !oput_rpmpt) { + oput_rpmpt = put_rpmpt; moveto(0, winw - 1 - rpromptw); zputs(rpromptbuf, shout); vcs = winw - 1; @@ -616,7 +640,6 @@ /* store current values so we can use them next time */ ovln = nvln; olnct = nlnct; - oput_rpmpt = put_rpmpt; onumscrolls = numscrolls; if (nlnct > vmaxln) vmaxln = nlnct;