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

* Re: [9fans] col.c: one line fix for variable-width font
  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
  0 siblings, 1 reply; 4+ messages in thread
From: erik quanstrom @ 2015-03-06 16:33 UTC (permalink / raw)
  To: 9fans

On Fri Mar  6 04:57:18 PST 2015, giacomo@tesio.it wrote:

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

that solves it.  you have a problem with $tabstop.  if you've cpu'd
or ssh'd somewhere, make sure the $tabstop is set properly, and that
the font you are using is available on the remote host, and $font
is pointing to it.

- erik



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

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

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

Actually I'm using drawterm, as a sort of remote desktop connection. But I
can't see the problem you are talking about.
The clients (either windows or linux) don't have the font installed, but
still it seem working pretty well (except for the spacing issues in man
pages). I don't have a real monitor attached to the xen server, so I can't
try it without drawterm.

col.c just ignores $tabstop in it's source code. It use a Tabstop = 8
constant instead (and a 7 value to check for position).
Changing the code to use $tabstop is trivial, and I even tried it, but it
neither fixed the initial problem nor decreased the man output size enough
to justify it's proposal.

I'm going to write a sed script to remove the leading margin (but not every
space or tab at the beginning of each line) from nroff output so that (with
my font and my 14inches monitor) I can use a 3 column acme to browse
/sys/src/ && read the code && browse man pages.
This should also reduce the man output size more than col.


Giacomo

2015-03-06 17:33 GMT+01:00 erik quanstrom <quanstro@quanstro.net>:

> On Fri Mar  6 04:57:18 PST 2015, giacomo@tesio.it wrote:
>
> > if ((++ncp & 7) == 0 && !xflag) {
> >
> > with
> >
> > if ((++ncp & 7) == 0 && !xflag && *(p-2) == ' ') {
>
> that solves it.  you have a problem with $tabstop.  if you've cpu'd
> or ssh'd somewhere, make sure the $tabstop is set properly, and that
> the font you are using is available on the remote host, and $font
> is pointing to it.
>
> - erik
>
>

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

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

* Re: [9fans] col.c: one line fix for variable-width font
  2015-03-06 17:22   ` Giacomo Tesio
@ 2015-03-06 17:27     ` Giacomo Tesio
  0 siblings, 0 replies; 4+ messages in thread
From: Giacomo Tesio @ 2015-03-06 17:27 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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

ehm... well... actually I could try with vnc... :-)


Giacomo

2015-03-06 18:22 GMT+01:00 Giacomo Tesio <giacomo@tesio.it>:

> Actually I'm using drawterm, as a sort of remote desktop connection. But I
> can't see the problem you are talking about.
> The clients (either windows or linux) don't have the font installed, but
> still it seem working pretty well (except for the spacing issues in man
> pages). I don't have a real monitor attached to the xen server, so I can't
> try it without drawterm.
>
> col.c just ignores $tabstop in it's source code. It use a Tabstop = 8
> constant instead (and a 7 value to check for position).
> Changing the code to use $tabstop is trivial, and I even tried it, but it
> neither fixed the initial problem nor decreased the man output size enough
> to justify it's proposal.
>
> I'm going to write a sed script to remove the leading margin (but not
> every space or tab at the beginning of each line) from nroff output so that
> (with my font and my 14inches monitor) I can use a 3 column acme to browse
> /sys/src/ && read the code && browse man pages.
> This should also reduce the man output size more than col.
>
>
> Giacomo
>
> 2015-03-06 17:33 GMT+01:00 erik quanstrom <quanstro@quanstro.net>:
>
>> On Fri Mar  6 04:57:18 PST 2015, giacomo@tesio.it wrote:
>>
>> > if ((++ncp & 7) == 0 && !xflag) {
>> >
>> > with
>> >
>> > if ((++ncp & 7) == 0 && !xflag && *(p-2) == ' ') {
>>
>> that solves it.  you have a problem with $tabstop.  if you've cpu'd
>> or ssh'd somewhere, make sure the $tabstop is set properly, and that
>> the font you are using is available on the remote host, and $font
>> is pointing to it.
>>
>> - erik
>>
>>
>

[-- Attachment #2: Type: text/html, Size: 2742 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).