[vim/vim] Matchfuzzy: Prefer complete matches over separator matches (#7140)

33 views
Skip to first unread message

Christian Brabandt

unread,
Oct 16, 2020, 3:15:34 AM10/16/20
to vim/vim, Subscribed

this is a fix for the recently discussed issue of matchfuzzy at vim-dev: https://groups.google.com/forum/#!topic/vim_dev/QQrHWIwI8jM

What this does is, give sequential matches a higher priority than separator matches, so that

echo matchfuzzy(['.vim/v_i_m_r_c', '.vim/vimrc', '.vim/vimrc_colors'], 'vimrc')

will return matches in the order of ['.vim/vimrc', '.vim/vimrc_colors', '.vim/v_i_m_r_c'].

For now this PR still contains the old changes to give an extra bonus for a omplete match. But this is commented out. I just left it in, just in case if we agree that this would be a good idea in general :)

If all agree that this is not needed, I'll remove that part and push up and merge everything into one single commit.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/7140

Commit Summary

  • Make matchfuzzy prefer complete matches over separator matches
  • matchfuzzy Fix tests and prefer complete matches

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Christian Brabandt

unread,
Oct 16, 2020, 7:14:15 AM10/16/20
to vim/vim, Push

@chrisbra pushed 1 commit.

  • 8624c28 fix failing test by sorting


You are receiving this because you are subscribed to this thread.

View it on GitHub or unsubscribe.

Christian Brabandt

unread,
Oct 16, 2020, 7:25:23 AM10/16/20
to vim/vim, Subscribed

those github actions failures are unrelated. Not sure why it fails in tests, that should run cleanly and which I haven't touched

Christian Brabandt

unread,
Oct 16, 2020, 8:09:05 AM10/16/20
to vim/vim, Push

@chrisbra pushed 1 commit.

  • 42180ac check ordering depending on windows/unix


You are receiving this because you are subscribed to this thread.

Yegappan Lakshmanan

unread,
Oct 16, 2020, 11:00:38 AM10/16/20
to vim/vim, Subscribed

@yegappan commented on this pull request.


In src/search.c:

> @@ -4358,6 +4364,10 @@ fuzzy_match_compute_score(
 	    score += FIRST_LETTER_BONUS;
 	}
     }
+ #if 0

Hi Christian,

Can you add a comment here about why this code is commented out?

Thanks,
Yegappan

Yegappan Lakshmanan

unread,
Oct 16, 2020, 11:25:22 AM10/16/20
to vim_dev, reply+ACY5DGFK4RS6UR64MB...@reply.github.com, vim/vim, Subscribed
Hi,

On Fri, Oct 16, 2020 at 8:00 AM Yegappan Lakshmanan <vim-dev...@256bit.org> wrote:

@yegappan commented on this pull request.


In src/search.c:

> @@ -4358,6 +4364,10 @@ fuzzy_match_compute_score(
 	    score += FIRST_LETTER_BONUS;
 	}
     }
+ #if 0

Hi Christian,

Can you add a comment here about why this code is commented out?



BTW, the test in FreeBSD (Cirrus/CI) is failing.

- Yegappan

vim-dev ML

unread,
Oct 16, 2020, 11:25:49 AM10/16/20
to vim/vim, vim-dev ML, Your activity

Hi,

On Fri, Oct 16, 2020 at 8:00 AM Yegappan Lakshmanan <
vim-dev...@256bit.org> wrote:

> *@yegappan* commented on this pull request.
> ------------------------------
>
> In src/search.c
> <https://github.com/vim/vim/pull/7140#discussion_r506517165>:

>
> > @@ -4358,6 +4364,10 @@ fuzzy_match_compute_score(
> score += FIRST_LETTER_BONUS;
> }
> }
> + #if 0
>
> Hi Christian,
>
> Can you add a comment here about why this code is commented out?
>
>
>
BTW, the test in FreeBSD (Cirrus/CI) is failing.

- Yegappan

Bram Moolenaar

unread,
Oct 16, 2020, 4:09:31 PM10/16/20
to vim/vim, vim-dev ML, Comment

I think we can just drop ENDMATCH_SEQUENTIAL_BONUS and the "fullMatch" variable. At least for now.


You are receiving this because you commented.

Christian Brabandt

unread,
Oct 17, 2020, 3:29:13 AM10/17/20
to vim/vim, vim-dev ML, Push

@chrisbra pushed 1 commit.

  • 430c58f sort matchfuzzy_mbyte expected result


You are receiving this because you are subscribed to this thread.

Christian Brabandt

unread,
Oct 18, 2020, 10:22:25 AM10/18/20
to vim/vim, vim-dev ML, Push

@chrisbra pushed 1 commit.

  • ffbdce2 Make matchfuzzy prefer complete matches over separator matches


You are receiving this because you are subscribed to this thread.

codecov[bot]

unread,
Oct 18, 2020, 10:51:17 AM10/18/20
to vim/vim, vim-dev ML, Comment

Codecov Report

Merging #7140 into master will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@

##           master    #7140      +/-   ##

==========================================

+ Coverage   88.71%   88.73%   +0.02%     

==========================================

  Files         148      148              

  Lines      162018   162113      +95     

==========================================

+ Hits       143732   143851     +119     

+ Misses      18286    18262      -24     
Impacted Files Coverage Δ
src/search.c 92.51% <ø> (ø)
src/vim9compile.c 93.03% <0.00%> (-0.11%) ⬇️
src/list.c 95.02% <0.00%> (ø)
src/version.c 92.13% <0.00%> (ø)
src/terminal.c 91.00% <0.00%> (ø)
src/evalfunc.c 96.28% <0.00%> (+<0.01%) ⬆️
src/eval.c 96.77% <0.00%> (+<0.01%) ⬆️
src/vim9execute.c 93.87% <0.00%> (+<0.01%) ⬆️
src/evalvars.c 95.74% <0.00%> (+0.01%) ⬆️
src/userfunc.c 93.52% <0.00%> (+0.01%) ⬆️
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d739de...ffbdce2. Read the comment docs.


You are receiving this because you commented.

Yegappan Lakshmanan

unread,
Oct 20, 2020, 9:30:53 AM10/20/20
to vim/vim, vim-dev ML, Comment

@yegappan approved this pull request.


You are receiving this because you commented.

Bram Moolenaar

unread,
Oct 20, 2020, 1:02:19 PM10/20/20
to vim/vim, vim-dev ML, Comment

Closed #7140 via e9f9f16.


You are receiving this because you commented.

Reply all
Reply to author
Forward
0 new messages