diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | lib/abbrev.rb | 8 |
2 files changed, 7 insertions, 4 deletions
@@ -4,6 +4,9 @@ Fri Nov 30 12:47:59 2012 Akinori MUSHA <knu@iDaemons.org> should only match the beginning of each word, not the beginning of every line in it. + * lib/abbrev.rb (Abbrev#abbrev): Stop using a regexp that causes a + false warning. [Bug #7471] + Fri Nov 30 12:30:55 2012 Akinori MUSHA <knu@iDaemons.org> * test/test_abbrev.rb: Add tests for lib/abbrev.rb. 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| |