Skip Menu |

This queue is for tickets about the Term-ReadLine-Gnu CPAN distribution.

Maintainer(s)' notes

When you report a bug, please provide the following information;

- output of
	perl -V
	perl Makefile.PL verbose
	make test TEST_VERBOSE=1
	perl -Mblib t/00checkver.t
	echo $TERM
- terminal emulator which you are using
- compiler which is used to compile the GNU Readline Library (libreadline.a) if you can know.
Read INSTALL in the distribution for more details.

Report information
The Basics
Id: 101835
Status: resolved
Priority: 0/
Queue: Term-ReadLine-Gnu

People
Owner: HAYASHI [...] cpan.org
Requestors: MORITZ [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.27



Subject: Two autocompletion examples don't work

Message body is not shown because it is too large.

Hi, There are some working examples in the Term-ReadLine-Gnu distribution. t/readline.t (run with option "verbose" - perl t/readline.t verbose) eg/fileman eg/perlsh eg/pftp And the most of works which use my module make use of auto-completion. https://metacpan.org/search?q=Term-ReadLine-Gnu Please take a look at them. A patch for my documentation is welcome to help other users. Thanks!
Hi, On Sat Jan 31 22:00:08 2015, HAYASHI wrote: Show quoted text
> Hi, > > There are some working examples in the Term-ReadLine-Gnu distribution. > > t/readline.t (run with option "verbose" - perl t/readline.t verbose) > eg/fileman > eg/perlsh > eg/pftp > > And the most of works which use my module make use of auto-completion. > > https://metacpan.org/search?q=Term-ReadLine-Gnu > > Please take a look at them.
Uhm, thanks for the pointers, but I still consider it a bug that the examples from the documentation don't work. Or did I miss some crucial point in docs that explain what else I need to do? At least to me, it reads like my attempts should work, so either it's a doc bug or a code bug, no? Best regards, Moritz
Hi, In your code my $attribs = $term->{Attribs}; must be my $attribs = $term->Attribs; as documented. The second code should work fine, but I've found completion_function variable is broken in your first code. I will debug it.
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)>
The fix is in 1.27.