Hi Paul,

Theo de Raadt wrote on Thu, Mar 29, 2018 at 04:17:14PM -0600:
> piroft@ wrote:

>> Is there any reason why manpage text does not resize nicely
>> with <80 columns xterms?

I want to avoid excessive magic.

By the way, actually, the default width is 78, not 80.
By tradition.

>> Is it because of less(1)?

No.  less(1) always wraps and re-wraps its input file to fit the
terminal width.  Of course, it preserves existing line breaks, it
only adds new ones, and it adds the new ones after the last character
that fits on each line, possibly in the middle of words and numbers.

> Can I do anything to fix this?

Yes.

When you want a manpage to exactly fill the available terminal width,
you can use an alias like this:

  $ alias wman='man -Owidth=$COLUMNS'            # or
  $ alias wman='man -Owidth=$((COLUMNS-2))'

Of course, if you change the terminal width while man(1) is open,
you will have to do: q Ctrl-p <enter> to reformat.

I do *NOT* want to add SIGWINCH signal handling to man(1) to abort
less(1), reformat, and respawn less(1) in that case.  That kind of
magic would be over the top, and SIGWINCH is an abomination in the
first place.

If you are in the habit of always using 65-column terminals on a given
machine, this is another option:

  # echo output width 64 >> /etc/man.conf

I *could* maybe teach man(1) to honour $COLUMN by default when
starting up in interactive mode, but i did not do so for the following
reasons:

 * Many people are using terminals wider than 80 columns, but
   texts get hard to read when much wider than that.  Very long
   lines become hard to follow.  (That's why newspapers usually
   have columns of even less than 80 characters, but they don't
   have as much indentation as manual pages either.)
 * Nowadays, i guess that terminals narrower than 80 columns
   have become seriously rare, so there is not very widespread
   benefit for that case.
 * Even if someone does use a narrower terminal, formatting will
   be somewhat poor with the matching -Owidth.  Some text, in
   particular literal displays, will still overflow and wrap in
   less(1), and text with large indentations will become
   ridiculously narrow.
   One thing jmc@ does is trying to make sure that pages do not
   only read well, but also look visually nice, and much of that
   work is optimized for the default -Owidth=78.
   So even for narrower terminals, i'd rather leave the decision
   to the user.
 * Setting up an alias as explained above is quite easy.

What i could maybe do is recognize "-Owidth=auto" and "output width
auto" in man.conf(5) and use $COLUMNS in that case, but even that
would require some additional code, and so far, i didn't notice
much demand.

> It is pre-formatted.

Only in the sense than man(1) completes the formatting before it
forks and executes less(1).  Only the manual pages of 25 (out of
9900) ports are still preformatted at port build time, and none in
the base system and Xenocara are preformatted at system build time.

Yours,
  Ingo

Reply via email to