From cc28002e5411af5c33a6d91c5edcf1860cc2dcf6 Mon Sep 17 00:00:00 2001 From: Geoff Wing Date: Wed, 24 Oct 2001 07:00:49 +0000 Subject: 16063: add transientrprompt option to remove right prompt from display when accepting commands --- Src/Zle/zle_refresh.c | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'Src/Zle/zle_refresh.c') diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c index c432907d1..7b4178ee8 100644 --- a/Src/Zle/zle_refresh.c +++ b/Src/Zle/zle_refresh.c @@ -76,6 +76,11 @@ mod_export int clearflag; /**/ 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 @@ resetvideo(void) olnct = nlnct = 0; if (showinglist > 0) showinglist = -2; + trashedzle = 0; } /* @@ -357,6 +363,20 @@ zrefresh(void) 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 @@ zrefresh(void) 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 @@ zrefresh(void) 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 @@ zrefresh(void) /* 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 @@ zrefresh(void) /* 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 @@ individually */ /* 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; -- cgit 1.4.1