summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToby Inkster <mail@tobyinkster.co.uk>2013-06-28 14:59:47 +0100
committerJesse Luehrs <doy@tozt.net>2013-06-28 10:39:12 -0400
commit0453bcc55e9d226298d37fe2d1fdab74659758b5 (patch)
treecdccc84f148200586dbaed48d7a19b9ca48fe346
parentbe18d16c78830d9fe69ed2d26f73f94cca03c956 (diff)
downloadreply-0453bcc55e9d226298d37fe2d1fdab74659758b5.tar.gz
reply-0453bcc55e9d226298d37fe2d1fdab74659758b5.zip
fix the bugs that DOY noted
-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');
}