Commit 61cf736c authored by Salvatore Bonaccorso's avatar Salvatore Bonaccorso

Imported Upstream version 0.004014

parent bf857760
......@@ -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'
IO::Prompter version 0.004013
IO::Prompter version 0.004014
Prompt for, read, vet, chomp, and encapsulate input.
Like so:
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment