From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gatech.edu (gatech.edu [130.207.244.244]) by werple.mira.net.au (8.6.12/8.6.9) with SMTP id FAA10004 for ; Sun, 9 Jul 1995 05:09:16 +1000 Received: from math (math.skiles.gatech.edu) by gatech.edu with SMTP id AA06379 (5.65c/Gatech-10.0-IDA for ); Sat, 8 Jul 1995 15:09:43 -0400 Received: by math (5.x/SMI-SVR4) id AA06976; Sat, 8 Jul 1995 15:04:48 -0400 Resent-Date: Sat, 8 Jul 1995 20:05:43 +0100 (BST) Old-Return-Path: From: Zefram Message-Id: <13685.199507081905@stone.dcs.warwick.ac.uk> Subject: print -c fixes To: zsh-workers@math.gatech.edu (Z Shell workers mailing list) Date: Sat, 8 Jul 1995 20:05:43 +0100 (BST) X-Loop: zefram@dcs.warwick.ac.uk X-Stardate: [-31]5948.97 Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-Id: <"4BpqA.0.wi1.FRj_l"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/183 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----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-----