Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
SINGLE_LINE_ZLE changes for better ksh emulation
- X-seq: zsh-workers 1679
- From: Zefram <A.Main@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Z Shell workers mailing list)
- Subject: SINGLE_LINE_ZLE changes for better ksh emulation
- Date: Wed, 17 Jul 1996 12:17:57 +0100 (BST)
-----BEGIN PGP SIGNED MESSAGE-----
The patch below make SINGLE_LINE_ZLE behave rather more like ksh.
Instead of putting < at the beginning of the line to indicate continuation
to the left, it puts it at the end; continuations in both directions are
indicated by a +. A space is left before the continuation character.
It's still not a perfect copy of ksh, as we scroll the prompt whereas
ksh keeps it on screen, but zsh prompts are often quite long compared
to ksh prompts so this makes sense.
-zefram
Index: Src/zle_refresh.c
===================================================================
RCS file: /home/zefram/usr/cvsroot/zsh/Src/zle_refresh.c,v
retrieving revision 1.7
diff -c -r1.7 zle_refresh.c
*** zle_refresh.c 1996/07/17 10:06:37 1.7
--- zle_refresh.c 1996/07/17 10:46:06
***************
*** 852,857 ****
--- 852,858 ----
int t0, /* tmp */
vsiz, /* size of new video buffer */
nvcs = 0; /* new video cursor column */
+ char rchar = 0; /* continuation indicator */
nlnct = 1;
/* generate the new line buffer completely */
***************
*** 860,866 ****
vsiz = (vsiz | 7) + 1;
else if (icntrl(line[t0]))
vsiz++;
! vbuf = (char *)zalloc(vsiz);
if (cs < 0) {
#ifdef DEBUG
--- 861,867 ----
vsiz = (vsiz | 7) + 1;
else if (icntrl(line[t0]))
vsiz++;
! vbuf = (char *)zalloc(vsiz + winw);
if (cs < 0) {
#ifdef DEBUG
***************
*** 875,886 ****
vp = vbuf + pptw;
for (t0 = 0; t0 != ll; t0++) {
! if (line[t0] == '\t')
for (*vp++ = ' '; (vp - vbuf) & 7; )
*vp++ = ' ';
- else if (line[t0] == '\n') {
- *vp++ = '\\';
- *vp++ = 'n';
} else if (line[t0] == 0x7f) {
*vp++ = '^';
*vp++ = '?';
--- 876,884 ----
vp = vbuf + pptw;
for (t0 = 0; t0 != ll; t0++) {
! if (line[t0] == '\t') {
for (*vp++ = ' '; (vp - vbuf) & 7; )
*vp++ = ' ';
} else if (line[t0] == 0x7f) {
*vp++ = '^';
*vp++ = '?';
***************
*** 897,910 ****
*vp = '\0';
/* determine which part of the new line buffer we want for the display */
! if ((winpos && nvcs < winpos + 1) || (nvcs > winpos + winw - 2)) {
if ((winpos = nvcs - ((winw - hasam) / 2)) < 0)
winpos = 0;
}
! if (winpos)
! vbuf[winpos] = '<'; /* line continues to the left */
! if ((int)strlen(vbuf + winpos) > (winw - hasam)) {
! vbuf[winpos + winw - hasam - 1] = '>'; /* line continues to right */
vbuf[winpos + winw - hasam] = '\0';
}
strcpy(nbuf[0], vbuf + winpos);
--- 895,914 ----
*vp = '\0';
/* determine which part of the new line buffer we want for the display */
! if ((winpos && nvcs < winpos + 1) || (nvcs > winpos + winw - hasam - 3)) {
if ((winpos = nvcs - ((winw - hasam) / 2)) < 0)
winpos = 0;
}
! if(winpos)
! rchar = '<'; /* continuation to the left */
! if ((int)strlen(vbuf + winpos) > (winw - hasam - 2*!!rchar))
! rchar = rchar ? '+' : '>'; /* continuation to the right */
! if (rchar) {
! char *p;
! for(p = strchr(vbuf, 0); p < vbuf + winpos + winw - hasam - 2; p++)
! *p = ' ';
! vbuf[winpos + winw - hasam - 2] = ' ';
! vbuf[winpos + winw - hasam - 1] = rchar;
vbuf[winpos + winw - hasam] = '\0';
}
strcpy(nbuf[0], vbuf + winpos);
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
iQCVAwUBMezHFHD/+HJTpU/hAQEk6QP/XiOH8YKv41EZuBbsOjhWT6lrfygmlMEC
Ym+deZGfF5w7074l94RLDkjd+J4nbqOYmjArPJP5FTryUpGJOuz6OnSiLtKWEebT
RznpDSz38rLzqMntMmAZkQMkYhyMPaIbaYVXPCTPB9rl0tDbW6FlVhhkF6+6lDG3
epo0CQMfmGI=
=5aAp
-----END PGP SIGNATURE-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author