[Bash-completion-commits] [SCM] bash-completion branch, master, updated. d2e8e66f096b4dae2305cd0ca8acef8705c77dff
Guillaume Rousse
Guillaume.Rousse at inria.fr
Tue Nov 16 22:05:11 UTC 2010
The following commit has been merged in the master branch:
commit d2e8e66f096b4dae2305cd0ca8acef8705c77dff
Author: Guillaume Rousse <Guillaume.Rousse at inria.fr>
Date: Tue Nov 16 23:05:08 2010 +0100
fix optimisation (bug #312832), and explain the code
diff --git a/completions/helpers/perl b/completions/helpers/perl
index 3c3a56b..b3522ac 100755
--- a/completions/helpers/perl
+++ b/completions/helpers/perl
@@ -8,8 +8,16 @@ my %seen;
sub print_modules_real {
my ($base, $dir, $word) = @_;
- # return immediately if the base doesn't match
- return if $base && $base !~ /^\Q$word/;
+ # return immediatly if potential completion doesn't match current word
+ # a double comparaison is used to avoid dealing with string lengths
+ # (the shorter being the pattern to be used as the regexp)
+ # word 'Fi', base 'File' -> match 'File' against 'Fi'
+ # word 'File::Sp', base 'File' -> match 'File::Sp' againt 'File'
+ return if
+ $base &&
+ $word &&
+ $base !~ /^\Q$word/ &&
+ $word !~ /^\Q$base/;
chdir($dir) or return;
--
bash-completion
More information about the Bash-completion-commits
mailing list