On 20/06/11 09:49, Sven Joachim wrote:
On 2011-06-20 08:33 +0200, Torquil Macdonald Sørensen wrote:

Man pages are displayed using 'less' in my terminal. However, I recently added

LESS="-N"

to my .bashrc because I decided I always want line numbering. However, now the
line breaking for man pages is not correct. The lines are too wide for my 
terminal,
so they are wrapped near the end. Therefore I now have almost an entire blink 
line
between each line of text in the man pages.

Shouldn't 'less' report a somewhat smaller line width to the man page generator,
since the first few character positions are now taken up by the line numbering
digits?

That does not seem to be possible because man calls less, not the other
way around.  However, you could achieve this by setting MANWIDTH to a
lower value than $COLUMNS.  Something like this (tested with bash and
zsh):

alias man='eval "MANWIDTH=\$(( \$COLUMNS - 8 ))" command man'

You have to use eval to force recomputation of $MANWIDTH in case the
terminal gets resized, and "command man" prevents recursive evaluation
of the alias.

Cheers,
        Sven

Thanks! But I came up with another solution that I prefer for now:

export MANPAGER="less -n"

Now 'man' won't use line numbers, but they are used when less is invoked everywhere else, both directly and indirectly. If other "indirect invocations" cause similar problems, I'll instead force line numbers only when I invoce less directly myself on the command line, by defining an alias. Or I might your your clever alias.

Thanks again, Sven!
Torquil



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to