summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorGeoff Wing <gcw@users.sourceforge.net>2001-10-24 07:00:49 +0000
committerGeoff Wing <gcw@users.sourceforge.net>2001-10-24 07:00:49 +0000
commitcc28002e5411af5c33a6d91c5edcf1860cc2dcf6 (patch)
tree135bf74fb1f6172494e496b60b7b1a47e965c545 /Src
parent14e13fb40743e069e45b0790f206f14b5f8a887a (diff)
downloadzsh-cc28002e5411af5c33a6d91c5edcf1860cc2dcf6.tar.gz
zsh-cc28002e5411af5c33a6d91c5edcf1860cc2dcf6.tar.xz
zsh-cc28002e5411af5c33a6d91c5edcf1860cc2dcf6.zip
16063: add transientrprompt option to remove right prompt from
display when accepting commands
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/zle_main.c1
-rw-r--r--Src/Zle/zle_refresh.c39
-rw-r--r--Src/options.c1
-rw-r--r--Src/zsh.h1
4 files changed, 34 insertions, 8 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index cec6c1b4e..42c7a6bb3 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1057,6 +1057,7 @@ trashzle(void)
 	 * extra `inlist' check]).                                          */
 	int sl = showinglist;
 	showinglist = 0;
+	trashedzle = 1;
 	zrefresh();
 	showinglist = sl;
 	moveto(nlnct, 0);
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;
diff --git a/Src/options.c b/Src/options.c
index cd45b31e9..fe0b8da30 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -199,6 +199,7 @@ static struct optname optns[] = {
 {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},
diff --git a/Src/zsh.h b/Src/zsh.h
index 74d0753bb..5e18c0ade 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1439,6 +1439,7 @@ enum {
     SINGLECOMMAND,
     SINGLELINEZLE,
     SUNKEYBOARDHACK,
+    TRANSIENTRPROMPT,
     UNSET,
     VERBOSE,
     XTRACE,