9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] col.c: one line fix for variable-width font
@ 2015-03-06 12:56 Giacomo Tesio
  2015-03-06 16:33 ` erik quanstrom
  0 siblings, 1 reply; 4+ messages in thread
From: Giacomo Tesio @ 2015-03-06 12:56 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs, 9front

[-- Attachment #1: Type: text/plain, Size: 651 bytes --]

I gave a look at col.c and found a better fix for the tabs issue.

We simply need that col check for the previous char being a space, before
adding any tab. That is, at /sys/src/cmd/col.c:251 replace

if ((++ncp & 7) == 0 && !xflag) {

with

if ((++ncp & 7) == 0 && !xflag && *(p-2) == ' ') {

This is a better fix that redefining col in /rc/bin/man since this way col
correctly replace spaces with tabs when appropriate. It just stops to
replace single spaces at positions multiple of 8 with tabs.


Giacomo
PS: col.c ignores $tabstop. This could be something to add in the man page.
Or to fix in col.c (a really trivial fix, btw)

[-- Attachment #2: Type: text/html, Size: 868 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-06 17:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-06 12:56 [9fans] col.c: one line fix for variable-width font Giacomo Tesio
2015-03-06 16:33 ` erik quanstrom
2015-03-06 17:22   ` Giacomo Tesio
2015-03-06 17:27     ` Giacomo Tesio

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