nixprime / cpsm

A CtrlP matcher, specialized for paths.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exact match failure case

rene-aguirre opened this issue · comments

It seems exact match with a prefix might score lower that a set of characters scattered over the full path.

Test input (test.txt), adding extra before and after placeholder lines:

noise/to/start.txt
Home/level/other/With/ore/al.d
kind/of/very/long/path/This/is/PrefixedHelloWorld.txt
some/path/to/fillup.txt

Matching:
cat test.txt | ./cpsm_cli --limit 2 --query HelloWorld

Output:

Home/level/other/With/ore/al.d
- score: 139646541430753; prefix_level = 0, whole_basename_match = 0, basename_longest_submatch = 0, basename_match_count = 0, basename_word_gaps = 0, crfile_basename_shared_words = 0, crfile_path_distance = 6, unmatched_suffix_len = 4, item_len = 30
- match positions: 0, 3, 5, 9, 11, 17, 22, 23, 27, 29
kind/of/very/long/path/This/is/PrefixedHelloWorld.txt
- score: 139646532747210; prefix_level = 0, whole_basename_match = 0, basename_longest_submatch = 0, basename_match_count = 0, basename_word_gaps = 0, crfile_basename_shared_words = 0, crfile_path_distance = 8, unmatched_suffix_len = 22, item_len = 53
- match positions: 39, 40, 41, 42, 43, 44, 45, 46, 47, 48

The exact "HelloWorld" match is weighted lower (mostly due crfile_path_distance score)

BTW... Thanks for the great work!

I have the same problem. I wish there would be an option to honor exact match, similar to FZF's --exact.