Show quoted text> The second code should work fine, but I've found completion_function
> variable is broken in your first code.
> I will debug it.
The fix contributed on
https://rt.cpan.org/Ticket/Display.html?id=72378 was wrong.
Here is the patch against 1.26. It will be included in the next release.
--- Gnu/XS.pm (revision 482)
+++ Gnu/XS.pm (working copy)
@@ -17,7 +17,7 @@
use AutoLoader 'AUTOLOAD';
use vars qw($VERSION);
-$VERSION='1.25'; # added for CPAN
+$VERSION='1.26'; # added for CPAN
# make aliases
use vars qw(%Attribs);
@@ -565,7 +565,10 @@
my($text, $state) = @_;
my $cf;
- return undef unless defined ($cf = $Attribs{completion_function});
+ if (not defined ($cf = $Attribs{completion_function})) {
+ carp "_trp_comletion_fuction: internal error\n";
+ return undef;
+ }
if ($state) {
$_i++;
@@ -580,7 +583,13 @@
return undef unless defined $_matches[0];
}
- return $_matches[$_i];
+ for (; $_i <= $#_matches; $_i++) {
+ # case insensitive match to be compatible with
+ # Term::ReadLine::Perl.
+ #
https://rt.cpan.org/Ticket/Display.html?id=72378
+ return $_matches[$_i] if ($_matches[$_i] =~ /^\Q$text/i);
+ }
+ return undef;
}
1;
Index: Gnu.pm
===================================================================
--- Gnu.pm (revision 482)
+++ Gnu.pm (working copy)
@@ -1817,7 +1817,7 @@
$attribs->{completion_function} = sub {
my ($text, $line, $start) = @_;
return qw(a list of candidates to complete);
- }
+ };
=item C<list_completion_function(TEXT, STATE)>