From 5a5d6f56accf652c1033078496105f299d426013 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 27 Jun 2013 18:02:51 -0400 Subject: don't complete keywords or packages if there's a sigil --- lib/Reply/Plugin/Autocomplete/Keywords.pm | 3 ++- 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; -- cgit v1.2.3-54-g00ecf