zsh-workers
 help / color / mirror / code / Atom feed
* print -c fixes
@ 1995-07-08 19:05 Zefram
  0 siblings, 0 replies; only message in thread
From: Zefram @ 1995-07-08 19:05 UTC (permalink / raw)
  To: Z Shell workers mailing list

-----BEGIN PGP SIGNED MESSAGE-----

This patch fixes a few ugly problems with print -c: spaces were added
to the right of the output to fill the last column; there were
sometimes fewer columns than there could be; and sometimes columns were
separated by more than they should be.  There problems were also
observable with completion lists, except for the extra spaces, and this
patch also fixes these problems there.

 -zefram

      *** Src/builtin.c.old	Sat Jul  8 18:56:09 1995
      --- Src/builtin.c	Sat Jul  8 19:46:46 1995
      ***************
      *** 4500,4510 ****
        	    if (l < (t = strlen(*ap)))
        		l = t;
        
      ! 	nc = (columns - 1) / (l + 2);
      ! 	sc = 0;
      ! 	if (nc)
      ! 	    sc = (columns - 1) / nc;
      ! 	else
        	    nc = 1;
        	nr = (n + nc - 1) / nc;
        
      --- 4500,4508 ----
        	    if (l < (t = strlen(*ap)))
        		l = t;
        
      ! 	sc = l + 2;
      ! 	nc = (columns + 1) / sc;
      ! 	if (!nc)
        	    nc = 1;
        	nr = (n + nc - 1) / nc;
        
      ***************
      *** 4513,4523 ****
        	    do {
        		l = strlen(*ap);
        		fprintf(fout, "%s", *ap);
      - 		for (; l < sc; l++)
      - 		    fputc(' ', fout);
        		for (t = nr; t && *ap; t--, ap++);
      ! 	    }
      ! 	    while (*ap);
        	    fputc(ops['N'] ? '\0' : '\n', fout);
        	}
        	if (fout != stdout)
      --- 4511,4521 ----
        	    do {
        		l = strlen(*ap);
        		fprintf(fout, "%s", *ap);
        		for (t = nr; t && *ap; t--, ap++);
      ! 		if(*ap)
      ! 		    for (; l < sc; l++)
      ! 			fputc(' ', fout);
      ! 	    } while (*ap);
        	    fputc(ops['N'] ? '\0' : '\n', fout);
        	}
        	if (fout != stdout)
      *** Src/zle_tricky.c.old	Sat Jul  8 19:52:45 1995
      --- Src/zle_tricky.c	Sat Jul  8 19:55:02 1995
      ***************
      *** 3524,3530 ****
        void
        listmatches(void)
        {
      !     int longest = 1, fct, fw = 0, colsz, t0, t1, ct, up, cl;
            int off, boff;
            int of = (isset(LISTTYPES) && !(haswhat & HAS_MISC));
            char **arr, **ap, sav;
      --- 3524,3530 ----
        void
        listmatches(void)
        {
      !     int longest = 1, fct, fw, colsz, t0, t1, ct, up, cl;
            int off, boff;
            int of = (isset(LISTTYPES) && !(haswhat & HAS_MISC));
            char **arr, **ap, sav;
      ***************
      *** 3568,3574 ****
            if (of)
        	longest++;
        
      !     fct = (columns - 1) / (longest + 2);
            if (fct == 0) {
        	fct = 1;
        	colsz = ct;
      --- 3568,3575 ----
            if (of)
        	longest++;
        
      !     fw = longest + 2;
      !     fct = (columns + 1) / fw;
            if (fct == 0) {
        	fct = 1;
        	colsz = ct;
      ***************
      *** 3578,3584 ****
        		(ispattern ? 0 :
        		(!(haswhat & HAS_MISC) ? fpl + fsl : lpl + lsl))) / columns;
            } else {
      - 	fw = (columns - 1) / fct;
        	colsz = (ct + fct - 1) / fct;
        	up = colsz + nlnct - clearflag;
            }
      --- 3579,3584 ----

-----BEGIN PGP SIGNATURE-----
Version: 2.6.i

iQBVAgUBL/7WXmWJ8JfKi+e9AQFXLQH/VrW/X0O6lkQPHUTt3L0F7snVoGnTZS8g
7B1OhDu0iSdcOkpWvYIS9fAcGgMPos5Y/jr23zfYtzEL7yVh+hjoEA==
=Kbjq
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-07-08 19:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-07-08 19:05 print -c fixes Zefram

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