* POSTPROMPT patches
@ 1996-07-29 3:21 Greg J. Badros
0 siblings, 0 replies; only message in thread
From: Greg J. Badros @ 1996-07-29 3:21 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: TEXT/PLAIN, Size: 706 bytes --]
I've included patches to add a new variable, $POSTPROMPT, which, if set,
outputs a prompt after it parses the command line. The patch also adds %H
to the prompt substitution characters, where %H means the last history
line.
The patch probably isn't perfect, and maybe someone can improve it for
inclusion in zsh-3.0, whenever that's set for release.
Recommended use of the patch is with XTERM, to set:
export POSTPROMPT='%{^[]0;%H^G%}'
which uses XTERM escape sequences to set the title bar to the currently
executing command; especially useful for longer-running commands.
I'm just now joining the zsh-workers list, so I apologize if I've missed
the boat in any way.
Greg J. Badros
gjb@cs.duke.edu
[-- Attachment #2: Type: TEXT/PLAIN, Size: 1865 bytes --]
*** 1.1 1996/07/29 01:39:01
--- globals.h 1996/07/29 01:39:09
***************
*** 329,334 ****
--- 329,335 ----
EXTERN char *prompt2; /* etc. */
EXTERN char *prompt3;
EXTERN char *prompt4;
+ EXTERN char *postprompt; /* $POSTPROMPT */
EXTERN char *rprompt; /* $RPROMPT */
EXTERN char *sprompt;
*** 1.1 1996/07/29 01:32:30
--- hashtable.h 1996/07/29 01:34:27
***************
*** 139,144 ****
--- 139,145 ----
IPDEF7("PS2", &prompt2),
IPDEF7("PS3", &prompt3),
IPDEF7("PS4", &prompt4),
+ IPDEF7("POSTPROMPT", &postprompt),
IPDEF7("RPS1", &rprompt),
IPDEF7("SPROMPT", &sprompt),
IPDEF7("0", &argzero),
*** 1.1 1996/07/29 01:31:43
--- init.c 1996/07/29 02:03:09
***************
*** 515,520 ****
--- 515,521 ----
prompt3 = ztrdup("");
prompt4 = ztrdup("");
}
+ postprompt = ztrdup("");
sprompt = ztrdup("zsh: correct '%R' to '%r' [nyae]? ");
if (!(ttystrname = ztrdup(ttyname(SHTTY))))
*** 1.1 1996/07/29 01:34:51
--- parse.c 1996/07/29 02:26:47
***************
*** 119,124 ****
--- 119,132 ----
} else {
l->right = par_event();
}
+ /* gjb added */
+ if (interact && postprompt != 0 && *postprompt != NULL) {
+ int plen=0;
+ curhist++;
+ fwrite(putprompt(postprompt,&plen,NULL,0), sizeof(char), plen, stderr);
+ fflush(stderr);
+ curhist--;
+ }
return l;
}
*** 1.1 1996/07/29 01:35:27
--- zle_misc.c 1996/07/29 03:04:27
***************
*** 1030,1035 ****
--- 1030,1044 ----
ss++;
stradd(ss);
break;
+ case 'H':
+ if (curhist > 0) {
+ int cch;
+ char *sz = quietgetevent(curhist-1);
+ cch = strlen(sz) - 1;
+ strncpy(bp,sz,cch);
+ bp += cch;
+ }
+ break;
case 'h':
case '!':
addbufspc(DIGBUFSIZE);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1996-07-29 3:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-29 3:21 POSTPROMPT patches Greg J. Badros
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).