fix hint counting

This commit is contained in:
Jorge Morante 2021-08-08 20:43:01 +02:00
parent e5a26b94d9
commit e4ee66c27f
1 changed files with 3 additions and 4 deletions

View File

@ -69,8 +69,6 @@ class ::Fingers::Hinter
def replace(match)
text = match[0]
return text if hints.empty?
captured_text = match && match.named_captures['capture'] || text
if match.named_captures['capture']
@ -82,6 +80,7 @@ class ::Fingers::Hinter
capture_offset = nil
end
if hints_by_text.has_key?(captured_text)
hint = hints_by_text[captured_text]
else
@ -110,8 +109,8 @@ class ::Fingers::Hinter
Fingers.benchmark_stamp('counting-matches:start')
lines.each do |line|
line.scan(pattern).each do |match|
match_set.add(match)
line.scan(pattern) do |match|
match_set.add($&)
end
end