zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <A.Main@dcs.warwick.ac.uk>
To: zsh-workers@math.gatech.edu (Z Shell workers mailing list)
Subject: SINGLE_LINE_ZLE changes for better ksh emulation
Date: Wed, 17 Jul 1996 12:17:57 +0100 (BST)	[thread overview]
Message-ID: <7835.199607171118@stone.dcs.warwick.ac.uk> (raw)

-----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-----



                 reply	other threads:[~1996-07-17 11:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7835.199607171118@stone.dcs.warwick.ac.uk \
    --to=a.main@dcs.warwick.ac.uk \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).