def match_with_syntax_highlight(match)
      highlight_chars = @prompt.abbrev.downcase.scan(/./mu)
      if @encoding &&
         match.respond_to?(:force_encoding) &&
         match.encoding != @encoding
        match = match.force_encoding(@encoding)
      end
      match.scan(/./mu).inject([]) do |output, char|
        if char.downcase == highlight_chars.first
          highlight_chars.shift
          output.concat [MH_START, char, MH_END]
        else
          output << char
        end
      end.join
    end
def match_with_syntax_highlight(match)
      highlight_chars = @prompt.abbrev.downcase.scan(/./mu)
      if @encoding &&
         match.respond_to?(:force_encoding) &&
         match.encoding != @encoding
        match = match.force_encoding(@encoding)
      end
      match.scan(/./mu).inject([]) do |output, char|
        if char.downcase == highlight_chars.first
          highlight_chars.shift
          output.concat [MH_START, char, MH_END]
        else
          output << char
        end
      end.join
    end
Highlight matching characters within the matched string.

 Note that this is only approximate; it will highlight the first matching
 instances within the string, which may not actually be the instances that
 were used by the matching/scoring algorithm to determine the best score
 for the match.