From f7c824c50425b2ea998215eae3e1b3cc5d0e74b4 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Sat, 11 Dec 2010 03:20:46 +0000 Subject: ido_switch: flex_match is now case-insensitive --- ido-mode/ido_switcher.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ido-mode') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index 5e22046..99f8260 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -295,7 +295,7 @@ sub update_matches { if ($ido_use_flex) { @search_matches = grep { flex_match($search_str, $_->{name}) } @window_cache; } else { - @search_matches = grep { $_->{name} =~ m/\Q$search_str\E/ } @window_cache; + @search_matches = grep { $_->{name} =~ m/\Q$search_str\E/i } @window_cache; } } @@ -303,11 +303,14 @@ sub update_matches { sub flex_match { my ($pattern, $source) = @_; - my @chars = split '', $pattern; + my @chars = split '', lc($pattern); my $i = -1; my $ret = 1; + + my $lc_source = lc($source); + foreach my $char (@chars) { - my $pos = index($source, $char, $i); + my $pos = index($lc_source, $char, $i); if ($pos > -1) { $i = $pos; } else { -- cgit v1.2.3