JazzCore / ctrlp-cmatcher

CtrlP C matching extension
BSD 2-Clause "Simplified" License
207 stars 22 forks source link

Incorrect highlight of match in results #7

Closed iw-kuchin closed 11 years ago

iw-kuchin commented 11 years ago

ctrlp-matcher highlights all found symbols in string instead of correct match only. It leads to some confusion. Minimal example to repoduce (NERDTree snapshot):

   /tmp/ctrlp-test/
   ▾ et/           
     ▾ tx/         
         text.txt  
     ololo.tst

Now, open ololo.tst and try to search for text. ctrlp highlights only text part from et/tx/text.txt. ctrlp-matcher instead highlights all characters except slashes.

JazzCore commented 11 years ago

Yes, this is known issue. When talking about fuzzy matching it's hard to make highlighting that will be correct it all cases. I dont like usual ctrlp highlighting ( e.g. in your example try search for texx with default ctrlp matcher, it will highlight text.tx ) so I made it to highlight all symbols. I'll try to look into this further.

iw-kuchin commented 11 years ago

Thanks for quick response.

Highlighting propsed by you doesn't allow to quickly understand where match actually occured. Provided example is very simple, but in actual projects there could be 4-5 levels of directory hierarchy with not-so-short names. When I do fuzzy search I want to check if search really found what I needed. When half of string is highlighted it's a bit difficult. And this in some way contradicts the purpose of fuzzy search: to find something quickly.

iw-kuchin commented 11 years ago

After some thinking: as an alternative to both ctrlp and ctrlp-matcher one can use highlighting where only matching symbols would be highlighted in order of appearance. I.e. for example with text.txt and texx it would be text.t xt. This variant is more "honest" than ctrlp's and produces less visual noise than yours.

iw-kuchin commented 11 years ago

Thanks a lot for fixing. Current master won't compile though, semicolon is missing in .c file on line 41. After adding it all compiles and works (compiler still issues some warnings). Again, many thanks for patch.

JazzCore commented 11 years ago

Bah, sorry about that. Should be fixed now.