From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3/2) with ESMTP id VAA17185 for ; Wed, 17 Jul 1996 21:26:24 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id HAA14318; Wed, 17 Jul 1996 07:19:25 -0400 (EDT) Resent-Date: Wed, 17 Jul 1996 07:19:25 -0400 (EDT) From: Zefram Message-Id: <7835.199607171118@stone.dcs.warwick.ac.uk> Subject: SINGLE_LINE_ZLE changes for better ksh emulation To: zsh-workers@math.gatech.edu (Z Shell workers mailing list) Date: Wed, 17 Jul 1996 12:17:57 +0100 (BST) X-Patch: 114 X-Loop: zefram@dcs.warwick.ac.uk X-Stardate: [-31]7822.35 X-US-Congress: Moronic fuckers MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"SyGu7.0.fV3.ymCxn"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1679 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----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-----