HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/x86_64-linux-gnu/perl5/5.34/auto/Term/ReadLine/Gnu/XS/_trp_completion_function.al
# NOTE: Derived from blib/lib/Term/ReadLine/Gnu/XS.pm.
# Changes made here will be lost when autosplit is run again.
# See AutoSplit.pm.
package Term::ReadLine::Gnu::XS;

#line 555 "blib/lib/Term/ReadLine/Gnu/XS.pm (autosplit into blib/lib/auto/Term/ReadLine/Gnu/XS/_trp_completion_function.al)"
#
#	wrapper completion function of 'completion_function'
#	for compatibility with Term::ReadLine::Perl
#
sub _trp_completion_function ( $$ ) {
    my($text, $state) = @_;

    my $cf;
    if (not defined ($cf = $Attribs{completion_function})) {
	carp "_trp_comletion_fuction: internal error\n";
	return undef;
    }

    if ($state) {
	$_i++;
    } else {
	# the first call
	$_i = 0;		# clear index
	@_matches = &$cf($text,
			 $Attribs{line_buffer},
			 $Attribs{point} - length($text));
	# return here since $#_matches is 0 instead of -1 when
	# @_matches = undef
	return undef unless defined $_matches[0];
    }

    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;

__END__
1;
# end of Term::ReadLine::Gnu::XS::_trp_completion_function