diff options
Diffstat (limited to 'gmi.pl')
-rwxr-xr-x | gmi.pl | 31 |
1 files changed, 21 insertions, 10 deletions
@@ -33,8 +33,8 @@ use File::Slurper qw(read_dir); # CPAN # sudo cpanm IO::Socket::SSL URL::XS IO::Pager Text::Wraper Term::ReadKey Path::Naive Text::ParseWords Term::ReadLine Smart::Comments URI::Encode IO::Socket::SSL::Utils File::Slurper my $wrapper = Text::Wrapper->new(columns=>70, body_start=>''); -$ENV{PAGER} = 'most'; -#$ENV{PAGER} = 'less -r'; +#$ENV{PAGER} = 'most'; +$ENV{PAGER} = 'less -R'; my $use_pager = 1; my $pager_text_wrap_auto = 1; my $doc_out = 1; # display doc for human consumption? @@ -685,18 +685,28 @@ sub display { my ($wc) = GetTerminalSize(); $wrapper->columns($wc); } - my $doc; - for (@doc) { - $doc .= $_; - } if ($use_pager) { IO::Pager::open(my $FH) or warn($!); - #print $FH $wrapper->wrap($doc); - print $FH $wrapper->wrap($doc); + for (@doc) { + _pre_block($_); + if ($pre_block) { + print $FH $_; + } + else { + print $FH $wrapper->wrap($_); + } + } } else { - #print($wrapper->wrap($doc)); - print $OUT $wrapper->wrap($doc); + for (@doc) { + _pre_block($_); + if ($pre_block) { + print $OUT $_; + } + else { + print $OUT $wrapper->wrap($_); + } + } } } @@ -791,6 +801,7 @@ sub _is_not_scheme_gemini { sub _pre_block { if (substr($_[0],0,3) eq '```') { toggle($pre_block,1); + return 1; } } |