diff options
author | Salvatore Bonaccorso <carnil@debian.org> | 2015-11-24 07:25:54 +0100 |
---|---|---|
committer | Salvatore Bonaccorso <carnil@debian.org> | 2015-11-24 07:25:54 +0100 |
commit | 61cf736c5732f89d0e1e3ee2100e07f2091969fa (patch) | |
tree | 4a8aef4cf26e8b7ae1e375e8622a3b81ad7f736d | |
parent | bf857760989701553afb5c450eced3f708a0ba78 (diff) |
Imported Upstream version 0.004014
-rw-r--r-- | Changes | 6 | ||||
-rw-r--r-- | META.json | 2 | ||||
-rw-r--r-- | META.yml | 2 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | lib/IO/Prompter.pm | 16 |
5 files changed, 16 insertions, 12 deletions
@@ -174,3 +174,9 @@ Revision history for IO-Prompter * Silenced warnings within test for valid input (Thanks Joel!) + + +0.004014 Tue Nov 24 08:50:00 2015 + + * Numerous improvements to completion behaviour + (Many thanks, Victor, and apologies for the long delay!) @@ -38,5 +38,5 @@ } }, "release_status" : "stable", - "version" : "0.004013" + "version" : "0.004014" } @@ -20,4 +20,4 @@ no_index: requires: Contextual::Return: '0' Test::More: '0' -version: '0.004013' +version: '0.004014' @@ -1,4 +1,4 @@ -IO::Prompter version 0.004013 +IO::Prompter version 0.004014 Prompt for, read, vet, chomp, and encapsulate input. Like so: diff --git a/lib/IO/Prompter.pm b/lib/IO/Prompter.pm index 4626324..b59de26 100644 --- a/lib/IO/Prompter.pm +++ b/lib/IO/Prompter.pm @@ -9,7 +9,7 @@ use Contextual::Return qw< PUREBOOL BOOL SCALAR METHOD VOID LIST RETOBJ >; use Scalar::Util qw< openhandle looks_like_number >; use Symbol qw< qualify_to_ref >; -our $VERSION = '0.004013'; +our $VERSION = '0.004014'; my $fake_input; # Flag that we're faking input from the source @@ -25,7 +25,7 @@ my $COMPLETE_HIST = $ENV{IO_PROMPTER_HISTORY_KEY} // qq{\cR}; my $COMPLETE_NEXT = qq{\cN}; my $COMPLETE_PREV = qq{\cP}; -my $COMPLETE_INIT = qr{ [$COMPLETE_KEY$COMPLETE_HIST] }xms; +my $COMPLETE_INIT = qr{ [\Q$COMPLETE_KEY$COMPLETE_HIST\E] }xms; my $COMPLETE_CYCLE = qr{ [$COMPLETE_NEXT$COMPLETE_PREV] }xms; my %COMPLETE_MODE = ( @@ -433,7 +433,7 @@ sub _decode_args { -style => sub{ q{} }, -nostyle => sub{ q{} }, -echostyle => sub{ q{} }, - -echo => sub { shift }, + -echo => sub { my $char = shift; $char eq "\t" ? q{ } : $char }, -return => sub { "\n" }, ); @@ -1271,8 +1271,8 @@ sub _generate_unbuffered_reader_from { state $completion_prefix; # ...skipped before completing # Track completion type and level (switch if necessary)... - if ($next =~ $COMPLETE_INIT && $next ne $completion_type) { - $completion_type = $next; + if ($next =~ $COMPLETE_INIT && index($completion_type, $next) < 0) { + $completion_type = index($COMPLETE_KEY, $next) >= 0 ? $COMPLETE_KEY : $COMPLETE_HIST; $completion_level = 1; } else { @@ -1282,7 +1282,7 @@ sub _generate_unbuffered_reader_from { # If starting completion, cache completions... if ($completion_level == 1) { ($completion_prefix, @completion_list) - = $next eq $COMPLETE_KEY + = index($COMPLETE_KEY, $next) >= 0 ? _current_completions_for($input, $opt_ref) : _current_history_for($input, $opt_ref); @completion_ring = (@completion_list, q{}); @@ -1514,8 +1514,6 @@ sub _generate_unbuffered_reader_from { # Not verbatim after mysterious ctrl input... $prev_was_verbatim = 0; - say grep { $ctrl{$_} eq $next } keys %ctrl; - next INPUT; } } @@ -1718,7 +1716,7 @@ IO::Prompter - Prompt for input, read it, clean it, return it. =head1 VERSION -This document describes IO::Prompter version 0.004013 +This document describes IO::Prompter version 0.004014 =head1 SYNOPSIS |