diff options
author | trizen <trizen@protonmail.com> | 2020-06-15 16:17:06 +0300 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-06-15 16:17:06 +0300 |
commit | fa3d4585fdc3e5cee48db59a561da0eaaeaddb23 (patch) | |
tree | a06e97bfeb80f89a86fee28cb871ecdf5a0efb8b | |
parent | 48d5267401926628bfab8abc61b2247ec3dede23 (diff) | |
download | fair-viewer-fa3d4585fdc3e5cee48db59a561da0eaaeaddb23.tar.lz fair-viewer-fa3d4585fdc3e5cee48db59a561da0eaaeaddb23.tar.xz fair-viewer-fa3d4585fdc3e5cee48db59a561da0eaaeaddb23.zip |
No longer include newlines in the message prompt for Term::ReadLine.
Instead, print the extra lines directly to STDOUT.
This fixes the backspace key when Term::ReadLine::Gnu::XS is not installed.
-rwxr-xr-x | bin/fair-viewer | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/fair-viewer b/bin/fair-viewer index bb30e6a..ebe8dd5 100755 --- a/bin/fair-viewer +++ b/bin/fair-viewer @@ -576,9 +576,7 @@ if ($opt{history}) { } # Add history to Term::ReadLine - if (eval { $term->can('ReadHistory') }) { - $term->ReadHistory($opt{history_file}); - } + eval { $term->ReadHistory($opt{history_file}) }; # All history entries my @history = $term->history_list; @@ -1924,7 +1922,11 @@ sub get_user_input { my $input = unpack( 'A*', defined($opt{std_input}) ? delete($opt{std_input}) - : ($term->readline($text) // return ':return') + : (do { + my @lines = split(/\R/, $text); + say for @lines[0..$#lines-1]; + $term->readline($lines[-1]); + } // return ':return') ) =~ s/^\s+//r; return q{:next} if $input eq q{}; # <ENTER> for the next page @@ -4170,7 +4172,8 @@ sub print_videos { } sub press_enter_to_continue { - scalar $term->readline(colored("\n=>> Press ENTER to continue...", 'bold')); + say ''; + scalar $term->readline(colored("=>> Press ENTER to continue...", 'bold')); } sub main_quit { |