Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jul 2007 21:09:31 +0100
From:      Rui Paulo <rpaulo@fnop.net>
To:        Fred Gilham <gilham@csl.sri.com>
Cc:        current@freebsd.org
Subject:   Re: less -r broken with long lines
Message-ID:  <469E737B.5090609@fnop.net>
In-Reply-To: <40882.1184765616@snapdragon.csl.sri.com>
References:  <469D651C.6080504@fnop.net> <40882.1184765616@snapdragon.csl.sri.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Fred Gilham wrote:
> Rui Paulo <rpaulo@fnop.net> wrote:
> 
>> Hi,
>> There's something about how the new less version handles lines greater
>> than the virtual terminal's size.
>>
>> Test case on an xterm/rxvt/screen session:
>>
>> less -r /etc/syslog.conf  - you won't see the $FreeBSD$ id tag because
>> of the long line regarding to /var/log/messages. Try resizing your
>> terminal so that this line fits in the right number of columns. You'll
>> see the problem disappear.
>>
>> less -r /etc/rc.firewall - since there are no long lines in the first
>> page, you won't notice the problem
>>
>> Everything works fine if less is used without the -r argument or if less
>> is run from the console.
>>
>> Does this ring any bell to anyone?
>>
>> Regards.
>> -- 
>> Rui Paulo
> 
> This is documented behavior.  From the "less" manpage:
> 
>        -r or --raw-control-chars
>               Causes "raw" control characters to be displayed.  The default is
>               to display control characters  using  the  caret  notation;  for
>               example, a control-A (octal 001) is displayed as "^A".  Warning:
>               when the -r option is used, less cannot keep track of the actual
>               appearance  of  the screen (since this depends on how the screen
>               responds to each type of control character).  Thus, various dis-
>               play  problems may result, such as long lines being split in the
>               wrong place.

It depends on the interpretation. "various display problems may result"
may very well be a reference to the fact that control characters mangle
the output. I wasn't expecting long lines to mangle the output. If you
less -r a file without control characters, but with a least a line wider
than your screen size, you'll notice the problem.

But, either way, less has been doing this for ages. I just took a long
time to notice it.

Regards.
-- 
Rui Paulo



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?469E737B.5090609>