safely chop highlight

This commit is contained in:
Jorge Morante 2022-04-22 15:48:53 +02:00
parent 31f7b6141e
commit a0971e7a0d
1 changed files with 2 additions and 2 deletions

View File

@ -58,9 +58,9 @@ class ::Fingers::MatchFormatter
def chop_highlight(hint, highlight)
if hint_position == 'right'
highlight[0..-(hint.length + 1)]
highlight[0..-(hint.length + 1)] || ""
else
highlight[hint.length..-1]
highlight[hint.length..-1] || ""
end
end
end