Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: Clearing RPS1: Is there a better way to do this?
- X-seq: zsh-workers 16063
- From: Geoff Wing <gcw@xxxxxxx>
- To: Zsh Hackers <zsh-workers@xxxxxxxxxx>
- Subject: PATCH: Re: Clearing RPS1: Is there a better way to do this?
- Date: Tue, 16 Oct 2001 15:26:40 +1000
- In-reply-to: <1011015171102.ZM8325@xxxxxxxxxxxxxxxxxxxxxxx>; from schaefer@xxxxxxxxxxxxxxxx on Mon, Oct 15, 2001 at 05:11:15PM +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: PrimeNet Computer Consultancy
- References: <20011015145302.A5483@xxxxxxxxxxxxxxx> <1011015171102.ZM8325@xxxxxxxxxxxxxxxxxxxxxxx>
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author