zsh-workers
 help / color / mirror / code / Atom feed
* Clearing RPS1: Is there a better way to do this?
@ 2001-10-14 18:11 Bart Schaefer
  2001-10-15  4:53 ` Geoff Wing
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2001-10-14 18:11 UTC (permalink / raw)
  To: zsh-workers

I've decided I'd like the right prompt to disappear when I accept a command,
because it gets in the way when doing cut-and-paste.  So I'm fooling with
something like this:

    wipe-RPS1-and-accept-line () {
        CURSOR=$#BUFFER
        zle -R
        print -nP %E
        zle .$WIDGET
    }
    zle -N accept-line wipe-RPS1-and-accept-line

The problem is that this prevents auto-removal of suffixes when RETURN is
pressed immediately after TAB.  Also, it means re-binding every variation
of accept-line (accept-and-hold, etc.).

Othere suggestions (including Geoff jumping up and offering to implement
this in the ZLE code) would be welcome.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Clearing RPS1: Is there a better way to do this?
  2001-10-14 18:11 Clearing RPS1: Is there a better way to do this? Bart Schaefer
@ 2001-10-15  4:53 ` Geoff Wing
  2001-10-15 17:11   ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Geoff Wing @ 2001-10-15  4:53 UTC (permalink / raw)
  To: Zsh Hackers

Bart Schaefer <schaefer@brasslantern.com> typed:
:Othere suggestions (including Geoff jumping up and offering to implement
:this in the ZLE code) would be welcome.

Controlled by setopt #136?  Name suggestion?  Doing it via a setopt,
the changes for the manual page would probably be bigger than the
changes for the code.

Regards,
-- 
Geoff Wing  <gcw@pobox.com>
rxvt stuff  <gcw@rxvt.org>
zsh stuff   <gcw@zsh.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Clearing RPS1: Is there a better way to do this?
  2001-10-15  4:53 ` Geoff Wing
@ 2001-10-15 17:11   ` Bart Schaefer
  2001-10-16  5:26     ` PATCH: " Geoff Wing
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2001-10-15 17:11 UTC (permalink / raw)
  To: Zsh Hackers

On Oct 15,  2:53pm, Geoff Wing wrote:
}
} Bart Schaefer <schaefer@brasslantern.com> typed:
} :Othere suggestions (including Geoff jumping up and offering to implement
} :this in the ZLE code) would be welcome.
} 
} Controlled by setopt #136?  Name suggestion?

That was my original thought, but I've been batting around the idea of
having it controlled by a prompt escape.

It'd be a bit odd to have an escape that means something only in the right
prompt, I guess.  I was even thinking maybe of overloading %E, e.g. in the
right prompt, %-1E causes it to be deleted after the fact, or something
like that.  Probably that's just too strange.

`setopt TRANSIENT_RPROMPT', perhaps?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* PATCH: Re: Clearing RPS1: Is there a better way to do this?
  2001-10-15 17:11   ` Bart Schaefer
@ 2001-10-16  5:26     ` Geoff Wing
  2001-10-16 15:16       ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Geoff Wing @ 2001-10-16  5:26 UTC (permalink / raw)
  To: Zsh Hackers

Bart Schaefer <schaefer@brasslantern.com> 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;


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: Re: Clearing RPS1: Is there a better way to do this?
  2001-10-16  5:26     ` PATCH: " Geoff Wing
@ 2001-10-16 15:16       ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2001-10-16 15:16 UTC (permalink / raw)
  To: Zsh Hackers

On Oct 16,  3:26pm, Geoff Wing wrote:
} Subject: PATCH: Re: Clearing RPS1: Is there a better way to do this?
}
} Bart Schaefer <schaefer@brasslantern.com> typed:
} :`setopt TRANSIENT_RPROMPT', perhaps?
} 
} RPROMPT won't disappear after positive response to > LISTMAX type questions.

That's not a problem.

} If this works OK for people (especially those who use
} ALWAYS_LAST_PROMPT (I don't)), I'll get some docs together for it.

I've got ALWAYS_LAST_PROMPT set, and it appears to work fine for me.

Thanks!

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-10-16 15:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-14 18:11 Clearing RPS1: Is there a better way to do this? Bart Schaefer
2001-10-15  4:53 ` Geoff Wing
2001-10-15 17:11   ` Bart Schaefer
2001-10-16  5:26     ` PATCH: " Geoff Wing
2001-10-16 15:16       ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).