summaryrefslogtreecommitdiffstats
path: root/lib/Reply/Plugin/Autocomplete/Functions.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Reply/Plugin/Autocomplete/Functions.pm')
-rw-r--r--lib/Reply/Plugin/Autocomplete/Functions.pm16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Reply/Plugin/Autocomplete/Functions.pm b/lib/Reply/Plugin/Autocomplete/Functions.pm
index b5690d4..233ec4d 100644
--- a/lib/Reply/Plugin/Autocomplete/Functions.pm
+++ b/lib/Reply/Plugin/Autocomplete/Functions.pm
@@ -28,14 +28,20 @@ sub tab_handler {
my ($before, $fragment) = $line =~ /(.*?)(${module_name_rx}(::)?)$/;
return unless $fragment;
- my ($package, $func) = ($fragment =~ /^(.+:)(\w+)$/);
- $func = '' unless defined $func;
- $package = $self->{'package'} unless $package;
- $package =~ s/::$//;
+ my ($package, $func);
+ if ($fragment =~ /:/) {
+ ($package, $func) = ($fragment =~ /^(.+:)(\w*)$/);
+ $func = '' unless defined $func;
+ $package =~ s/:{1,2}$//;
+ }
+ else {
+ $package = $self->{'package'};
+ $func = $fragment;
+ }
return
map { $package eq $self->{'package'} ? $_ : "$package\::$_" }
- grep { /^\Q$func/ }
+ grep { $func ? /^\Q$func/ : 1 }
'Package::Stash'->new($package)->list_all_symbols('CODE');
}