summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--fzytest.c8
-rw-r--r--match.c8
3 files changed, 10 insertions, 10 deletions
diff --git a/README.md b/README.md
index 32b1f7a..587ebc1 100644
--- a/README.md
+++ b/README.md
@@ -48,10 +48,10 @@ nnoremap <leader>s :call FzyCommand("ag . --no-color -l -g ''", ":sp")<cr>
fzy attempts to present the best matches first. The following considerations are weighted when sorting:
-It prefers matching the beginning of words: `amo` is likely to match <tt><b>a</b>pp/<b>m</b>odels/<b>o</b>rder.rb</tt>.
-
It prefers consecutive characters: `file` will match <tt><b>file</b></tt> over <tt><b>fil</b>t<b>e</b>r</tt>.
+It prefers matching the beginning of words: `amp` is likely to match <tt><b>a</b>pp/<b>m</b>odels/<b>p</b>osts.rb</tt>.
+
It prefers shorter matches: `abce` matches <tt><b>abc</b>d<b>e</b>f</tt> over <tt><b>abc</b> d<b>e</b></tt>.
It prefers shorter candidates: `test` matches <tt><b>test</b>s</tt> over <tt><b>test</b>ing</b></tt>.
diff --git a/fzytest.c b/fzytest.c
index a0620f5..3842920 100644
--- a/fzytest.c
+++ b/fzytest.c
@@ -29,8 +29,8 @@ int test_match(){
}
int test_scoring(){
- /* App/Models/Order is better than App/MOdels/foo */
- assert(match("amo", "app/models/foo") < match("amo", "app/models/order"));
+ /* App/Models/Order is better than App/MOdels/zRder */
+ assert(match("amor", "app/models/order") > match("amor", "app/models/zrder"));
/* App/MOdels/foo is better than App/M/fOo */
assert(match("amo", "app/m/foo") < match("amo", "app/models/foo"));
@@ -72,8 +72,8 @@ int test_positions_2(){
* We should prefer matching the 'o' in order, since it's the beginning
* of a word.
*/
- size_t positions[3];
- match_positions("amo", "app/models/order", positions);
+ size_t positions[4];
+ match_positions("amor", "app/models/order", positions);
assert(positions[0] == 0);
assert(positions[1] == 4);
assert(positions[2] == 11);
diff --git a/match.c b/match.c
index ee0b066..0c50eb7 100644
--- a/match.c
+++ b/match.c
@@ -77,10 +77,10 @@ double calculate_score(const char *needle, const char *haystack, size_t *positio
#define SCORE_GAP_TRAILING -0.005
#define SCORE_GAP_INNER -0.01
#define SCORE_MATCH_CONSECUTIVE 1.0
-#define SCORE_MATCH_SLASH 1.5
-#define SCORE_MATCH_WORD 1.2
-#define SCORE_MATCH_CAPITAL 1.1
-#define SCORE_MATCH_DOT 0.8
+#define SCORE_MATCH_SLASH 0.9
+#define SCORE_MATCH_WORD 0.8
+#define SCORE_MATCH_CAPITAL 0.7
+#define SCORE_MATCH_DOT 0.6
/* Which positions are beginning of words */
char last_ch = '\0';