[vim/vim] insexpand: filter non-prefix fuzzy omnifunc matches when leader is NULL (PR #19447)

5 views
Skip to first unread message

h_east

unread,
Feb 18, 2026, 9:07:02 AM (yesterday) Feb 18
to vim/vim, Subscribed

Fixes: #19328 ?

When 'autocomplete' first fires, compl_leader is NULL because ins_compl_start() has not set it yet. This caused the prefix filter in ins_compl_build_pum(), find_next_completion_match() and find_common_prefix() to be bypassed, allowing non-prefix fuzzy omnifunc matches to appear in the PUM and be preinserted.

Extend get_leader_for_startcol() to fall back to compl_orig_text when compl_leader.string is NULL: if the match's cpt source startcol is less than compl_col the match includes pre-compl_col text, so return &compl_leader (NULL string) to signal "pass through"; otherwise return &compl_orig_text so callers filter by the original text. The compl_col <= 0 guard is kept only for the prepend-text path to avoid it interfering with the NULL-leader fallback when compl_col is zero.

With this change all callers of get_leader_for_startcol() automatically receive the correct filter string without additional helpers.

Also update Test_autocomplete_trigger Test 9 to reflect the new behavior: 'faberge' is no longer shown when completing 'foo' because it does not start with the current prefix.

Add Test_autocomplete_preinsert_null_leader() to verify that only prefix-matching candidates appear in the PUM and are preinserted.


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

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

Commit Summary

  • 46201d5 insexpand: filter non-prefix fuzzy omnifunc matches when leader is NULL

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19447@github.com>

h_east

unread,
Feb 18, 2026, 9:09:37 AM (yesterday) Feb 18
to vim/vim, Subscribed
h-east left a comment (vim/vim#19447)

@girishji Please review this.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19447/c3921038414@github.com>

girish

unread,
4:28 AM (11 hours ago) 4:28 AM
to vim/vim, Subscribed

@girishji approved this pull request.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19447/review/3824426618@github.com>

girish

unread,
4:29 AM (11 hours ago) 4:29 AM
to vim/vim, Subscribed
girishji left a comment (vim/vim#19447)

Thanks, reviewed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19447/c3925867990@github.com>

Christian Brabandt

unread,
12:03 PM (4 hours ago) 12:03 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19447)

thanks both! 🙏


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19447/c3928558634@github.com>

Christian Brabandt

unread,
12:15 PM (3 hours ago) 12:15 PM
to vim/vim, Subscribed

Closed #19447 via a04ae02.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19447/issue_event/22922777237@github.com>

Reply all
Reply to author
Forward
0 new messages