Hello community, here is the log from the commit of package perl-IO-Pager for openSUSE:Factory checked in at 2020-11-07 21:01:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-IO-Pager (Old) and /work/SRC/openSUSE:Factory/.perl-IO-Pager.new.11331 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-IO-Pager" Sat Nov 7 21:01:47 2020 rev:29 rq:846188 version:2.10 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-IO-Pager/perl-IO-Pager.changes 2020-11-03 15:17:38.396102070 +0100 +++ /work/SRC/openSUSE:Factory/.perl-IO-Pager.new.11331/perl-IO-Pager.changes 2020-11-07 21:03:26.197830888 +0100 @@ -1,0 +2,26 @@ +Thu Nov 5 03:11:02 UTC 2020 - Tina Müller <[email protected]> + +- updated to 2.10 + see /usr/share/doc/packages/perl-IO-Pager/CHANGES + + 2.10 Nov + ::Perl Alter tp local script installation for parallel make. RT#133651 + ::Perl Add basic Windows support. RT#133663 + ::Perl Add TOPT environment variable to tp. + ::Perl Enable scrollbar in interactive test 16. + +------------------------------------------------------------------- +Wed Nov 4 03:07:16 UTC 2020 - Tina Müller <[email protected]> + +- updated to 2.01 + see /usr/share/doc/packages/perl-IO-Pager/CHANGES + + 2.01 Nov 02 2020 + ::Perl Fixed bug that left terminal in unclean state if exit at EOF + was enabled. + ::Perl Fixed jump to end of file shortcut to show last line on bottom + of screen instead of top to provide more context. + ::Perl Made scrollbar interactive using xterm control sequences. + ::Perl Added scroll wheel support using xterm control sequences. + +------------------------------------------------------------------- Old: ---- IO-Pager-2.00.tgz New: ---- IO-Pager-2.10.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-IO-Pager.spec ++++++ --- /var/tmp/diff_new_pack.yovbfQ/_old 2020-11-07 21:03:26.745830016 +0100 +++ /var/tmp/diff_new_pack.yovbfQ/_new 2020-11-07 21:03:26.749830010 +0100 @@ -17,7 +17,7 @@ Name: perl-IO-Pager -Version: 2.00 +Version: 2.10 Release: 0 %define cpan_name IO-Pager Summary: Select a pager (possibly perl-based) & pipe it text if a TTY ++++++ IO-Pager-2.00.tgz -> IO-Pager-2.10.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/IO-Pager-2.00/CHANGES new/IO-Pager-2.10/CHANGES --- old/IO-Pager-2.00/CHANGES 2020-11-02 02:20:04.000000000 +0100 +++ new/IO-Pager-2.10/CHANGES 2020-11-04 17:25:30.000000000 +0100 @@ -1,11 +1,31 @@ Revision history for Perl extension IO::Pager. +2.10 Nov + ::Perl Alter tp local script installation for parallel make. RT#133651 + + ::Perl Add basic Windows support. RT#133663 + + ::Perl Add TOPT environment variable to tp. + + ::Perl Enable scrollbar in interactive test 16. + +2.01 Nov 02 2020 + ::Perl Fixed bug that left terminal in unclean state if exit at EOF + was enabled. + + ::Perl Fixed jump to end of file shortcut to show last line on bottom + of screen instead of top to provide more context. + + ::Perl Made scrollbar interactive using xterm control sequences. + + ::Perl Added scroll wheel support using xterm control sequences. + 2.00 Nov 01 2020 Fix interactive tests 7 and 16 in bogus environments w/o PAGER. RT#13330 Add tp to local script installation. RT#133651 - Add suport for visible scrollbar. RT#133652 + ::Perl Add suport for visible scrollbar. RT#133652 ::Perl Rename prompt() to status(), I18N{prompt} to I18N{minihelp}, and I18N{status} to I18N{prompt} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/IO-Pager-2.00/META.json new/IO-Pager-2.10/META.json --- old/IO-Pager-2.00/META.json 2020-11-02 02:55:52.000000000 +0100 +++ new/IO-Pager-2.10/META.json 2020-11-05 00:58:30.000000000 +0100 @@ -4,7 +4,7 @@ "Jerrad Pierce <[email protected]>, Florent Angly <[email protected]>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010", "license" : [ "unknown" ], @@ -53,9 +53,11 @@ } }, "release_status" : "stable", - "version" : "2.00", + "version" : "2.10", "x_runtime" : { - "recommends" : {} + "recommends" : { + "Win32::Console::ANSI" : 0 + } }, - "x_serialization_backend" : "JSON::PP version 2.97001" + "x_serialization_backend" : "JSON::PP version 4.04" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/IO-Pager-2.00/META.yml new/IO-Pager-2.10/META.yml --- old/IO-Pager-2.00/META.yml 2020-11-02 02:55:52.000000000 +0100 +++ new/IO-Pager-2.10/META.yml 2020-11-05 00:58:27.000000000 +0100 @@ -12,7 +12,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010' license: unknown meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -35,7 +35,8 @@ Tie::Handle: '0' base: '0' perl: '5.008000' -version: '2.00' +version: '2.10' x_runtime: - recommends: {} + recommends: + Win32::Console::ANSI: 0 x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/IO-Pager-2.00/Makefile.PL new/IO-Pager-2.10/Makefile.PL --- old/IO-Pager-2.00/Makefile.PL 2020-11-01 22:01:27.000000000 +0100 +++ new/IO-Pager-2.10/Makefile.PL 2020-11-04 03:00:48.000000000 +0100 @@ -1,6 +1,9 @@ use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. + +my @WINANSI = $^O =~ /MSWin/ ? ('Win32::Console::ANSI'=>0) : (); + WriteMakefile( 'MIN_PERL_VERSION' => 5.8.0, 'NAME' => 'IO::Pager', @@ -11,7 +14,7 @@ 'Env' => 0, 'Exporter' => 0, 'File::Temp' => 0, - 'bignum' => 0, + 'bignum' => 0 }, 'PREREQ_PM' => { 'base' => 0, @@ -26,12 +29,12 @@ 'Text::Wrap' => 0, 'Tie::Handle' => 0, }, - EXE_FILES => [ 'blib/lib/IO/Pager/tp' ], + EXE_FILES => [ 'lib/IO/Pager/tp' ], META_MERGE => { "meta-spec" => { version => 2 }, runtime => { recommends => { -# #Since Term::Pager is unmodern + @WINANSI # 'Term::ReadKey' => 0, }, }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/IO-Pager-2.00/README new/IO-Pager-2.10/README --- old/IO-Pager-2.00/README 2020-06-15 03:41:33.000000000 +0200 +++ new/IO-Pager-2.10/README 2020-11-04 03:05:45.000000000 +0100 @@ -12,7 +12,7 @@ and set the PAGER environment variable sanely or as a factory for creating objects defined elsewhere such as IO::Pager::Buffered, IO::Pager::Unbuffered, and IO::Pager::less which provides a pure perl -pager. +pager called tp. IO::Pager subclasses are designed to programmatically decide whether or not to pipe a filehandle's output to a program specified in PAGER. @@ -38,8 +38,13 @@ base, Env, File::Spec, File::Which, IO::Handle, PerlIO, SelectSaver, Symbol, Text::Wrap, Tie::Handle +Term::ReadKey is also require for IO::Pager::less, IO::Pager::Perl and tp. +Win32::Console::ANSI, included in some distributions of Win32 perl like +Strawberry is recommended on Windows for IO::Pager::less et al. to function. + Test::More is used during the installation procedure. + PORTABILITY IO::Pager is intended to be as portable as possible, I've tested it on numerous diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/IO-Pager-2.00/TODO new/IO-Pager-2.10/TODO --- old/IO-Pager-2.00/TODO 2020-11-02 02:42:43.000000000 +0100 +++ new/IO-Pager-2.10/TODO 2020-11-05 00:57:59.000000000 +0100 @@ -2,21 +2,30 @@ Ctrl-Home/End for top/bottom. -Pgup/PgDn (konsole) for file next/prev? -2.0 - scrollbar: - pipe calcuations? - thumb size: txtN/rows = pages; rows/pages = thumb - - grep scrolling is borked - dialog, refresh if _grep instead of specific row refresh - modify calls to line() to pass row? keep a buffer of - {_row}->[$row]=$line? - use screen as buffer: scroll-up decrement cursor until match/top & emit - - squishing throws off line numbering. okay for jumping, awkward for - cross-referencing file in an editor +2.10 +IPP Use alternate screen buffer? + +IPP MS Windows +IPP scrolling commands are wonky, therefore we currently waste +IPP cycles refreshing... but it works! Fix? +IPP https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#viewport-positioning + +IPP more.com exits at EOF. Tests should be longer, or warn of this? +IPP or set $ENV{PAGER}='IO::Pager::less' if $^O =~ /MSWin/ + + MakeMaker __VERSION__? + +2.00 +IPP Fix interaction with KDE konsole RT#133662 +IPP Check xterm, rxvt, gde-term, etc. +IPP Goofy term sizes (and WINCH) 1.03 +IPP grep scrolling is borked +IPP dialog, refresh if _grep instead of specific row refresh +IPP modify calls to line() to pass row? keep a buffer of +IPP {_row}->[$row]=$line? +IPP use screen as buffer: scroll-up decrement cursor until match/top & emit Lesskey #command !! - toggle-option #switch toggle_* to this?! @@ -31,17 +40,16 @@ IPP kprv,knxt,khome,kend,kbs[backspace],kf1(help?),kich1(insert as mark?) 1.02 -IPP rename tp to ppp ("pure" perl pager)? (except stty/tput, and ReadKey) +IPP Rearchitect around String::Tagged::Terminal? Term::Screen? -IPP return if $Squeeze and $me->{_text}-[cur] eq '' and -IPP $me->{_text}->[prev] eq '' +IPP Move squeeze from input to logical display to allow runtime toggle? IPP Document line numbering impacts?! (perf, RAM...) +IPP okay for jumping, awkward for x-ref file in an editor IPP WINCH reflow: keep cursor at same content? IPP Display filename in status line? -IPP Rearchitect around String::Tagged::Terminal? 1.01 @@ -53,18 +61,6 @@ 1.00 IPP #Consolidate _cursor+{rows} and _end?? -IPP resize 126 $me->{_end} = $me->{rows} - 1; #NOOP -IPP new 113 $me->{_end} = $me->{rows} - 1; #NOOP, just setting up -IPP line 507 $me->{_end} = $n; #Advance past pause!! -IPP down_ln 518 if( $me->{_end} >= $me->{_txtN}-1 ){ #detect EOF!! -IPP down_ln 522 if(length($me->{pause}) && $me->{_end}<$me->{rows}-1){ -IPP down_ln 523 print $t->Tgoto('cm', 0, $me->{_end}+1 ); } # move! -IPP down_ln 532 $me->line( ++$me->{_end} ); #print! -IPP up_line 552 $me->{_end}--; #NOOP, just keeping up -IPP jump 609 $me->{_end} = $me->{_cursor} + $me->{rows}; #NOOP -IPP search 671 $me->{_end} = $me->{_cursor} + $me->{rows}; # - 1; -IPP search 678 $me->{_end} -= $x; #NOOP, just keeping up - IPP Pause bugs IPP Left/right when paused causes vertical scrolling @@ -75,8 +71,6 @@ IPP navigation IPP search -IPP $0 as name in status line? - IPP Wrap up tp for PerlTools? 0.43 @@ -89,8 +83,6 @@ print() on unopened filehandle STDOUT at Term/Pager.pm line 330 print() on unopened filehandle STDOUT at Term/Pager.pm line 395..399 - Test functionality w/|w/o Term::ReadKey - 0.35 Odd failure of test 11 under tcsh and win-bash because *reference* has extra trailing newline. @@ -102,4 +94,7 @@ and document location of each in matrix OR use table-driven tests? new/open each class scalar vs. glob vs. OO - (non-)fully qualified subclass name \ No newline at end of file + (non-)fully qualified subclass name + +IPP w/|w/o Term::ReadKey + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/IO-Pager-2.00/lib/IO/Pager/Perl.pm new/IO-Pager-2.10/lib/IO/Pager/Perl.pm --- old/IO-Pager-2.00/lib/IO/Pager/Perl.pm 2020-11-02 02:55:19.000000000 +0100 +++ new/IO-Pager-2.10/lib/IO/Pager/Perl.pm 2020-11-05 00:57:29.000000000 +0100 @@ -1,5 +1,5 @@ package IO::Pager::Perl; -our $VERSION = '2.00'; #Untouched since 2.00 +our $VERSION = '2.10'; #Untouched since 2.10 use strict; use warnings; @@ -13,12 +13,11 @@ sub ReadMode; sub ReadKey; - sub new { my $class = shift; my %param = @_; - local $ENV{TERM} = $ENV{TERM} || ''; - local $ENV{TERMCAP} = $ENV{TERM} || ''; + $ENV{TERM} = $ENV{TERM} || ''; + $ENV{TERMCAP} = $ENV{TERMCAP} || ''; my %dims = get_size(cols =>$param{cols} ||80, rows =>$param{rows} ||25, @@ -27,25 +26,38 @@ #screen is vt100 compatible but does not list sf?! #No matter, it's only used for workaround mode. - if( $ENV{TERM} eq 'screen' && $ENV{TERMCAP} !~ /sf/ ){ - $ENV{TERM} = 'vt100'; - } + $ENV{TERM} = 'vt100' if( $ENV{TERM} eq 'screen' && $ENV{TERMCAP} !~ /sf/ ); -#cm=>cup, ce=>el, cl=>clear, sf=>ind, sr=>ri -#md=>bold, me=>sgr0, mr=>rev, us=>smul - #Speed is mostly useless except Term::Cap expects it? + #Hack together Windows support. We could use Term::Screen(::Uni), + #but that uses many layers of tie-ing, some of which could be inheritiance. + #This way also reduces dependencies + if( $^O =~ /MSWin/ ){ + eval "use Win32::Console::ANSI;"; + if( $@ ){ + warn "Could not load Win32::Console::ANSI, falling back to dumb mode - $@"; } + else{ + $ENV{TERM} = 'WINANSI'; + #Windows lacks vb as does the fallback Term::Cap vt220 entry, add our own + #https://www.ibiblio.org/oswg/oswg-nightly/oswg/en_US.ISO_8859-1/articles/alessandro-rubini/visual-bell/visual-bell-howto.html#VISIBLEBELL + $ENV{TERMCAP} = do{ undef $/; $_=<DATA>; y/\n//d; $_ }; + } + } + else{ + #Try to enable mouse support + print "\e[?1000;1006;1015h"; + } + #Speed is mostly useless except Term::Cap demands it my $t = Term::Cap->Tgetent({ OSPEED => $param{speed} }); - eval{ $t->Trequire(qw/cm ce cl sf sr/) }; - my $dumb = $@ ? 1 : 0; + my $dumb = eval{ $t->Trequire(qw/cm ce cl sf sr/) } ? 1 : 0; - my %primitives = ( - # if the entries don't exist, nothing bad will happen + #CORE: cm=>cup, ce=>el, cl=>clear, sf=>ind, sr=>ri + #EXTRA: md=>bold, me=>sgr0, mr=>rev, us=>smul, vb=>flash + my %primitives = (# if the entries don't exist, nothing bad will happen BLD => $t->Tputs('md'), # Bold ULN => $t->Tputs('us'), # Underscore REV => $t->Tputs('mr'), # Reverse NOR => $t->Tputs('me'), # Normal ); - my $text; if( defined( $param{text} ) ){ my $ref = ref( $param{text} ); @@ -126,12 +138,14 @@ add_keys(\&to_bott, '>', 'G', '$', "\e>", "\e[F", "\e0E", "\e0W", "\e[4~"); #M-> ? End End End add_keys(\&downpage, ' ', 'z', "\cV", , 'f', "\cF", "\e ", "\e[6~"); #M- PgDn + add_keys(\&downpage, "\eOs") if $ENV{TERM} eq 'WINANSI'; add_keys(\&downhalf, 'd', "\cD"); add_keys(\&downline, 'e', 'j', 'J', "\cE", "\cN", "\e[B"); #down - add_keys(\&downline_raw, "\n"); + add_keys(\&downline_raw, "\n", "\r"); add_keys(\&upline, 'y', 'k', "\cY", "\cK", 'K', 'Y', "\cP", "\e[A"); #up add_keys(\&uphalf, 'u', "\cU"); add_keys(\&uppage, 'w', 'b', "\cB", "\ev", "\e[5~"); #M-v PgUp + add_keys(\&uppage, "\eOy") if $ENV{TERM} eq 'WINANSI'; add_keys(\&to_top, '<', 'g', "\e<", "\e[H", "\e0", "\e[1~"); #M-< Home Home Home add_keys(\&next_file, ':n', "\e[1;4C"); @@ -151,6 +165,7 @@ #"\e\[1;3D"=> #M-right $me->add_func(%config, + "\e[<" => \&mouse, '/(\d+)/' => 1, #jump to line "\e[D" => \&tab_left, #left "\e[C" => \&tab_right, #right, @@ -172,7 +187,7 @@ $me->{_end} = $me->{rows} - 1; - $SIG{WINCH} = sub{ $me->resize() }; + $SIG{WINCH} = sub{ $me->resize() } unless $ENV{TERM} eq 'WINANSI'; $me->{cols}-- if $me->{scrollBar}; #Can we fold? @@ -206,7 +221,7 @@ } $me->status(); - $me->{WINCH}->() if ref($me->{WINCH}) eq 'CODE'; + $me->{WINCH}->() if ref($me->{WINCH}) eq 'CODE'; } sub get_size { @@ -229,13 +244,16 @@ *ReadKey = sub{ getc() }; #Can we get better defaults? - if( `stty` =~ /speed/ ){ - @dims{'rows','cols'} = ($1-1,$2-1) if `stty size` =~ /^(\d+)\s+(\d+)$/; - $dims{speed} = $1 if `stty speed` =~ /^(\d+)$/; + if( $ENV{TERM} eq 'WINANSI' ){ + eval{ @dims{'rows','cols'} = Win32::Console::ANSI::Cursor() }; + } + elsif( `stty` =~ /speed/ ){ + @dims{'rows','cols'} = ($1-1,$2-1) if `stty size` =~ /^(\d+)\s+(\d+)$/; + $dims{speed} = $1 if `stty speed` =~ /^(\d+)$/; } else{ - $dims{rows} = `tput lines` || $dims{rows}; - $dims{cols} = `tput cols` || $dims{cols}; + $dims{rows} = `tput lines` || $dims{rows}; + $dims{cols} = `tput cols` || $dims{cols}; } } return %dims; @@ -365,8 +383,8 @@ return 1 unless defined($char); $me->{_I18N}{prompt} = $input .= $char; $me->status(); - - unless( ($input=~ /^\e/ and index($me->{_fncRE}, $input)>0 ) + + unless( ($input=~ /^\e/ and index($me->{_fncRE}, $input)>0 ) || $input =~ /^\d+/ || $input =~ /:+/ || defined($me->{_fnc}->{$input}) ){ @@ -376,9 +394,11 @@ } if( $me->{_fnc}->{$input} ){ - use B 'svref_2object'; - my $n = $me->{_fnc}->{$input}; - $n = svref_2object($n)->GV->NAME; + #Get mapped sub name +# use B 'svref_2object'; +# my $n = $me->{_fnc}->{$input}; +# $n = svref_2object($n)->GV->NAME; + $exit = $me->{_fnc}->{$input}->($me); $me->{_I18N}{prompt} = $input = ''; } @@ -396,7 +416,7 @@ elsif( $char eq "\cG" ){ $input = ''; $exit = 1; } - elsif( $char eq "\n" ){ + elsif( $char eq "\n" || $char eq "\r" ){ #Remove extraneous characters that could cause infinite error loop #XXX this prevents goofy RPN-like repeated commands $input =~ y/0-9//cd;# chomp($input); @@ -498,6 +518,7 @@ my $end= $me->{_cursor} + $me->{rows}; my $pct = $me->{_txtN} > $end ? $end/($me->{_txtN}) : 1; + #XXX unify with scrollbar: consistency and as private property my $pos = $me->{_cursor} ? ($pct==1 ? $me->{_I18N}{bottom} : 'L'.$me->{_cursor}) : $me->{_I18N}{top}; @@ -508,7 +529,7 @@ print $me->{_term}->Tputs('ce'); # clear line my $minihelp = $me->{_I18N}{minihelp}; (my $pSansCodes = $p) =~ s/\e\[[\d;]*[a-zA-Z]//g; - my $pN = $me->{cols} - 2 - length($pSansCodes) - length($me->{_I18N}{minihelp}); + my $pN = $me->{cols} -1 -length($pSansCodes) -length($me->{_I18N}{minihelp}); $p .= ' ' x ($pN > 1 ? $pN : 1); $minihelp = $pN>2 ? $minihelp : do {$minihelp =~ s/\000.+//; $minihelp }; print $me->{REV}; # reverse video @@ -518,7 +539,7 @@ sub close{ ReadMode 0; - print "\n"; + print "\n\e[?1000l"; $| = $SP || 0; #Did we exit via signal or user? $RT ? die : return \"foo"; @@ -622,13 +643,50 @@ sub scrollBar{ my $me = shift; - my $mark = sprintf("%i", $me->{_cursor} / $me->{_txtN} * $me->{rows}); - my $pages = sprintf("%i", $me->{_txtN}/$me->{rows}); - my $thumb = int($me->{rows}/$pages); + $me->{_pages} = $me->{_txtN}/$me->{rows}; + $me->{_thumbW} = $me->{rows}/$me->{_pages}; + $me->{_thumbT} = sprintf("%i", ($me->{_cursor} / $me->{_pages}) )+($me->{_cursor}>$me->{_txtN}/2); + $me->{_thumbB} = sprintf("%i", $me->{_thumbT}+$me->{_thumbW}); + +#$me->dialog("cursor $me->{_cursor} top $me->{_thumbT} + width $me->{_thumbW}"); for my $n (0 .. $me->{rows} -1){ print $me->{_term}->Tgoto('cm', $me->{cols}+1, $n); - print $n>=$mark && $n<$mark+$thumb ? ' ' : "$me->{REV} $me->{NOR}"; + print $n>=$me->{_thumbT} && $n<$me->{_thumbB} ? ' ' : "$me->{REV} $me->{NOR}"; + } +} + +sub mouse{ + my $me = shift; + my $input =''; + $input .= ReadKey(0) until $input =~ /M$/i; + + my @args = split /;/, $input; + + if( $args[0] == 65 ){ + $me->downhalf(); } + elsif( $args[0] == 64 ){ + $me->uphalf(); } + elsif( $me->{scrollBar} && $args[1] == $me->{cols}+1 ){ + if( chop $args[2] eq 'm'){ #mouse-up + if( $me->{_thumbDrag} ){ + $me->{_thumbDrag} = 0; + my $pos; + if( $args[2]==1 ){ + $pos=0 } + elsif( $args[2]==$me->{rows} ){ + $pos= $me->{_txtN} - 2*$me->{rows}-1 } + else{ + $pos = sprintf("%i", $args[2] / $me->{rows} * $me->{_txtN}) } + $me->jump($pos); + } + $me->uppage() if $args[2] < $me->{_thumbT}; + $me->downpage() if $args[2] > $me->{_thumbB}; + } + elsif( $args[2]>=$me->{_thumbT} && + $args[2]<=$me->{_thumbB} ){ #automagically M (mouse-down) + $me->{_thumbDrag}=1; + } } } @@ -695,7 +753,7 @@ LINE: for(1..$n){ if( $me->{_end} >= $me->{_txtN}-1 ){ - exit if $me->{eof} && ref($me->{text}) ne 'CODE'; + $me->close() if $me->{eof} && ref($me->{text}) ne 'CODE'; if( ref($me->{text}) eq 'CODE' ){ $me->add_text( $me->{text}->() ); } else{ @@ -732,6 +790,7 @@ $me->{_cursor}++; } } + $me->refresh() if $ENV{TERM} eq 'WINANSI'; #XXX Windows scroll is lame $me->scrollBar() if $me->{scrollBar}; } sub downhalf { $_[0]->down_lines( $_[0]->{rows} / 2 ); } @@ -739,7 +798,6 @@ #WTF?! add_text in tp's while-loop cannot be reached if there's #no delay here until something other than downpage is called?! select(undef, undef, undef, .1); #XXX WTF?! -# warn "\n\n", map{$_[0]->{$_}."\n"} qw/rows _cursor _end/; } sub downline { $_[0]->down_lines( 1 ); } #Term::ReadKey doesn't offer sufficiently fine control; we want CS8 but -OCRNL @@ -774,6 +832,7 @@ } } + $me->refresh() if $ENV{TERM} eq 'WINANSI'; #XXX Windows scroll is lame print $me->{_term}->Tgoto('cm',0,$me->{rows}); # goto bottom $me->scrollBar() if $me->{scrollBar}; } @@ -785,7 +844,11 @@ sub to_bott{ my $me = shift; - $me->jump( $me->{rows}>$me->{_txtN} ? 0 : $me->{_txtN}-$me->{rows} ); + if( $me->{rows}>$me->{_txtN} ){ + $me->jump( 0 ) } + else{ + $me->jump( $me->{_txtN}-1 ); + $me->uppage() } } sub save_mark{ @@ -1048,6 +1111,24 @@ } 1; +__DATA__ +WINANSI|vt220|Win32 Console based on DEC VT220 in vt100 emulation mode: +am:mi:xn:xo: +co#80:li#24: +RA=\E[?7l:SA=\E[?7h: +ac=kkllmmjjnnwwqquuttvvxx:ae=\E(B:al=\E[L:as=\E(0: +bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH: +cr=^M:cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:do=\E[B: +ei=\E[4l:ho=\E[H:im=\E[4h: +is=\E[1;24r\E[24;1H: +nd=\E[C: +kd=\E[B::kl=\E[D:kr=\E[C:ku=\E[A:le=^H: +mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m: +kb=\0177: +r2=\E>\E[24;1H\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E=:rc=\E8: +sc=\E7:se=\E[27m:sf=\ED:so=\E[7m:sr=\EM:ta=^I: +ue=\E[24m:up=\E[A:us=\E[4m:ve=\E[?25h:vi=\E[?25l: +vb=\E7\E[?5h\E[?5l\E[?5h\E[?5l\E[?5h\E[?5l\E[?5h\E[?5l\E8: __END__ =pod @@ -1124,6 +1205,12 @@ By default, chracters other than tab and newline will be converted to caret notation e.g; ^@ for null or ^L for form feed. +=item I<scrollBar> =E<gt>0 + +=item B<--scrollbar> + +Display an interactive scrollbar in the right-most column. + =item I<squeeze> =E<gt>0 Collapse multiple blank lines into one. @@ -1405,6 +1492,10 @@ If you also need notification of this signal, the handler will trigger any callback assigned to the I<WINCH> attribute of the C<new> method. +I<WINCH> is not available on Windows. You will need to manually refresh your +screen B<^L> if you resize the terminal in Windows to clean up the text +however, this will not change the size of the pager itself. + =head1 ENVIRONMENT IO::Pager::Perl checks the I<TERM> and I<TERMCAP> variables. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/IO-Pager-2.00/lib/IO/Pager/less.pm new/IO-Pager-2.10/lib/IO/Pager/less.pm --- old/IO-Pager-2.00/lib/IO/Pager/less.pm 2020-11-01 21:48:42.000000000 +0100 +++ new/IO-Pager-2.10/lib/IO/Pager/less.pm 2020-11-04 17:36:13.000000000 +0100 @@ -227,10 +227,6 @@ Jerrad Pierce <[email protected]> -Florent Angly <[email protected]> - -This module was inspired by Monte Mitzelfelt's IO::Page 0.02 - Significant proddage provided by Tye McQueen. =head1 COPYRIGHT AND LICENSE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/IO-Pager-2.00/lib/IO/Pager/tp new/IO-Pager-2.10/lib/IO/Pager/tp --- old/IO-Pager-2.00/lib/IO/Pager/tp 2020-11-02 02:40:12.000000000 +0100 +++ new/IO-Pager-2.10/lib/IO/Pager/tp 2020-11-04 17:29:37.000000000 +0100 @@ -6,7 +6,7 @@ use Getopt::Long; use vars '$VERSION'; -$VERSION = '1.04'; #Untouched since 1.04 +$VERSION = '2.10'; #Untouched since 2.10 my %Opts = (fold=>1); (my $LESS = $ENV{LESS} || '') =~ s/P.+(?:\$|$)//; @@ -18,6 +18,7 @@ $Opts{fold} = 0 if $LESS =~ /S/; $Opts{pause} = "\cL" if defined($ENV{MORE}) && $ENV{MORE} =~ /l/; +@ARGV = (map('-'.$_, split(//, $ENV{TPOPT})), @ARGV) if defined($ENV{TPOPT}); my %Long; #Custom argument processing @@ -32,7 +33,7 @@ (map { "$_!" } split//, 'JSenrs'), # bare (map { "$_=s" } qw'j p cols'), # args ##rows 'f:s', - qw/tail scrollbar/ + qw/tail|$ scrollbar|[/ ); $Long{f} = "\cL" if defined($Long{f}) && $Long{f} eq ''; $Long{tail} = $Long{tail} && scalar(@ARGV) == 1 ? 1 : 0; @@ -53,7 +54,6 @@ $Opts{scrollBar} = $Long{scrollbar} if defined($Long{scrollbar}); - #use Data::Dumper; print Dumper \%Opts; exit 0; my $t = IO::Pager::Perl->new(%Opts); @@ -107,6 +107,7 @@ if( $cursize > $prevsize ){ $t->add_text($X) if sysread($FILE, $X, $cursize-$prevsize); $prevsize = $cursize; + $t->scrollbar() if $t->{scrollBar}; } } } @@ -145,7 +146,7 @@ You might also supply a regular expression as STR e.g; - tp -f '[ie]t' bar #pauses on lines in bar with "i" or "e" in them + tp -f '[ie]t' bar #pauses on lines in bar with "it" or "et" in them =item B<-J> @@ -169,13 +170,11 @@ Do not fold long lines. -=item B<--scrollbar> - -Display a scrollbar in the rightmost column. +=item B<-[> or B<--scrollbar> -In the future this might also disable the top/bottom/% display in the status bar. +Display an interactive scrollbar in the right-most column. -=item B<--tail> +=item B<-$> or B<--tail> Keep checking the displayed file for new content. Only available when paging a single file. @@ -308,7 +307,13 @@ =head1 ENVIRONMENT -tp checks the I<LESS>, I<MORE>, I<TERM> and I<TERMCAP> variables. +tp checks the I<LESS>, I<MORE>, I<TPOPT>, I<TERM> and I<TERMCAP> variables. + +The I<TPOPT> variable is used to set options explicitly for tp, by +concatenating undecorated options together e.g; Sr for squished raw output. + +I<LESS> and I<MORE> are checked for options that tp supports, and if detected +they are enabled. =head1 SEE ALSO diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/IO-Pager-2.00/lib/IO/Pager.pm new/IO-Pager-2.10/lib/IO/Pager.pm --- old/IO-Pager-2.00/lib/IO/Pager.pm 2020-11-02 02:55:29.000000000 +0100 +++ new/IO-Pager-2.10/lib/IO/Pager.pm 2020-11-04 17:29:53.000000000 +0100 @@ -1,5 +1,5 @@ package IO::Pager; -our $VERSION = "2.00"; #Untouched since 1.03 +our $VERSION = "2.10"; #Untouched since 1.03 use 5.008; #At least, for decent perlio, and other modernisms use strict; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/IO-Pager-2.00/t/16-PurePerl_interactive.t new/IO-Pager-2.10/t/16-PurePerl_interactive.t --- old/IO-Pager-2.00/t/16-PurePerl_interactive.t 2020-11-01 22:15:28.000000000 +0100 +++ new/IO-Pager-2.10/t/16-PurePerl_interactive.t 2020-11-04 19:53:28.000000000 +0100 @@ -12,6 +12,7 @@ use blib; $ENV{PERL5OPT} = '-Mblib'; + $ENV{TPOPT} = '['; require IO::Pager; require IO::Pager::less; { @@ -23,13 +24,17 @@ #XXX repeating input loop, but cannot hurt to preserve the instructions warn "\n\nCurrent IO::Pager::Less is suboptimal \e[7;5m*** Press Ctrl-L to refresh ***\e[0m\n\n\n"; - $BOB->print("This pager is implemented in perl\n") foreach 1..25; + #XX $BOB->{scrollBar}=1; + + $BOB->print("This pager is implemented in perl. Note the nifty scrollbar at right.\n") foreach 1..250; $BOB->print("\nEnd of text, try pressing 'Q' to exit.\n"); } select STDERR; my $A1 = prompt("\nDid you see 'This pager is implemented in perl' in a pager? [Yn]"); ok is_yes($A1), 'OO, factory instantiation'; + my $A2 = prompt("\nDid the scrollbar update as you scrolled? [Yn]"); + ok is_yes($A2), 'Scrollbar works.'; }
