tag 758689 confirmed patch
thanks
On Wed, Aug 20, 2014 at 06:15:55PM +1200, Olly Betts wrote:
Package: perl
Version: 5.20.0-4
Severity: normal
The output from perldoc now contains visible escape sequences, e.g.:
$ perldoc perlfaq
ESC[1mNAMEESC[0m
perlfaq - frequently asked questions about Perl
As discussed on IRC, this is a side effect of the default output formatter
backend changing to 'term' from 'man'. From the Pod-Perldoc changelog:
3.20 - Sat Apr 27 05:25:30 UTC 2013
* Make default formatter ToTerm instead of ToMan for
better UTF-8 support
The 'man' backend doesn't have this problem, as seen by
$ perldoc -oman perlfaq
Also, the 'term' backend had the problem with 5.18 already, as seen with
$ perldoc -oterm perlfaq
This seems to be a feature of the 'less' pager and doesn't happen with
for instance 'more'. Quoting less.1:
-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.
-R or --RAW-CONTROL-CHARS
Like -r, but only ANSI color escape sequences are
output in raw form. Unlike -r, the screen appearance
is maintained correctly in most cases. [...]
Bug #243370 is related, and Damyan has recently asked to make -R the
default. Until that, the best I can think of is to patch append the -R
option to $ENV{LESS} before invoking the pager. This shouldn't affect
other pagers in any way, and multiple -R options are ok with 'less'.
(It does seem to override -r, but I'm not sure if we care.)
Lightly tested patch attached. I can't see a way to discover inside
Perldoc::page() whether we're using the 'ToTerm' backend, so the LESS
environment variable is changed unconditionally.
--
Niko Tyni nt...@debian.org
From 314cc25bca7ab3d6a3b2e040bbb496c47419bb87 Mon Sep 17 00:00:00 2001
From: Niko Tyni nt...@debian.org
Date: Sat, 23 Aug 2014 18:46:43 -0700
Subject: [PATCH] Tell the 'less' pager to allow terminal escape sequences
The 'ToTerm' backend generates terminal escape sequences that
the 'less' pager does not display by default. The -R option
controls this, so pass it in the LESS environment variable
to avoid disturbing other pager invocations.
Bug-Debian: https://bugs.debian.org/758689
---
cpan/Pod-Perldoc/lib/Pod/Perldoc.pm | 1 +
1 file changed, 1 insertion(+)
diff --git a/cpan/Pod-Perldoc/lib/Pod/Perldoc.pm b/cpan/Pod-Perldoc/lib/Pod/Perldoc.pm
index 6ddd21d..5c6ea98 100644
--- a/cpan/Pod-Perldoc/lib/Pod/Perldoc.pm
+++ b/cpan/Pod-Perldoc/lib/Pod/Perldoc.pm
@@ -1892,6 +1892,7 @@ sub page { # apply a pager to the output file
if ($self-is_vms) {
last if system($pager $output) == 0;
} else {
+$ENV{LESS} .= -R; # ToTerm outputs escape codes
last if system($pager \$output\) == 0;
}
}
--
2.1.0