fix potential infinite loop in show_matching highlighter