diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-06-27 18:02:51 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-06-27 18:02:51 -0400 |
commit | 5a5d6f56accf652c1033078496105f299d426013 (patch) | |
tree | b0f85dd1229934993f5fa5254054990975ce57be /lib | |
parent | 436bede5fac60885a053baadf5dd659b258997b0 (diff) | |
download | reply-5a5d6f56accf652c1033078496105f299d426013.tar.gz reply-5a5d6f56accf652c1033078496105f299d426013.zip |
don't complete keywords or packages if there's a sigil
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Reply/Plugin/Autocomplete/Keywords.pm | 3 | ||||
-rw-r--r-- | lib/Reply/Plugin/Autocomplete/Packages.pm | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/Reply/Plugin/Autocomplete/Keywords.pm b/lib/Reply/Plugin/Autocomplete/Keywords.pm index 85bfe1e..b3ec05a 100644 --- a/lib/Reply/Plugin/Autocomplete/Keywords.pm +++ b/lib/Reply/Plugin/Autocomplete/Keywords.pm @@ -23,8 +23,9 @@ sub tab_handler { my $self = shift; my ($line) = @_; - my ($last_word) = $line =~ /(\w+)$/; + my ($before, $last_word) = $line =~ /(.*?)(\w+)$/; return unless $last_word; + return if $before =~ /[\$\@\%\&\*]\s*$/; my $re = qr/^\Q$last_word/; diff --git a/lib/Reply/Plugin/Autocomplete/Packages.pm b/lib/Reply/Plugin/Autocomplete/Packages.pm index bfdd143..e414e4a 100644 --- a/lib/Reply/Plugin/Autocomplete/Packages.pm +++ b/lib/Reply/Plugin/Autocomplete/Packages.pm @@ -25,8 +25,9 @@ sub tab_handler { my ($line) = @_; # $module_name_rx does not permit trailing :: - my ($package_fragment) = $line =~ /(${module_name_rx}:?:?)$/; + my ($before, $package_fragment) = $line =~ /(.*?)(${module_name_rx}:?:?)$/; return unless $package_fragment; + return if $before =~ /[\$\@\%\&\*]\s*$/; my $file_fragment = $package_fragment; $file_fragment =~ s{::}{/}g; |