diff options
Diffstat (limited to 'lib/abbrev.rb')
-rwxr-xr-x[-rw-r--r--] | lib/abbrev.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/abbrev.rb b/lib/abbrev.rb index 443ab6d8f1..d4f8196f49 100644..100755 --- a/lib/abbrev.rb +++ b/lib/abbrev.rb @@ -73,9 +73,9 @@ module Abbrev end words.each do |word| - next if (abbrev = word).empty? - while (len = abbrev.rindex(/[\w\W]\z/)) > 0 - abbrev = word[0,len] + next if word.empty? + word.size.downto(1) { |len| + abbrev = word[0...len] next if pattern && pattern !~ abbrev @@ -87,7 +87,7 @@ module Abbrev else break end - end + } end words.each do |word| |