Permalink
Browse files

Make matching character highlighting case-insensitive

The matching algorithm is case-insensitive, which means that the display
of matching characters must also be done in a case-insensitive fashion.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
  • Loading branch information...
wincent committed Mar 25, 2012
1 parent 2e26ac5 commit 1c47bcc7aa1dbc4fe445a2c32fba1dc22084a7fb
Showing with 4 additions and 3 deletions.
  1. +4 −3 ruby/command-t/match_window.rb
@@ -316,10 +316,11 @@ def match_text_for_idx idx
# for the match.
#
def match_with_syntax_highlight match
- highlight_chars = @prompt.abbrev.chars.to_a
+ highlight_chars = @prompt.abbrev.downcase.chars.to_a
match.chars.inject([]) do |output, char|
- if char == highlight_chars.first
- output.concat [MH_START, highlight_chars.shift, MH_END]
+ if char.downcase == highlight_chars.first
+ highlight_chars.shift
+ output.concat [MH_START, char, MH_END]
else
output << char
end

0 comments on commit 1c47bcc

Please sign in to comment.