aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/provider/python.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2026-02-20 08:57:15 +0800
committerzeertzjq <zeertzjq@outlook.com>2026-02-20 08:58:41 +0800
commit08b8fe5ab36ee3df3ce593942565d4cd318373c4 (patch)
tree5fca11b7acc9b098a3de299773dfa07d1e48f327 /runtime/lua/vim/provider/python.lua
parente3d46a63375c84b7bd409f1f07ef56eb985eae50 (diff)
downloadrneovim-08b8fe5ab36ee3df3ce593942565d4cd318373c4.tar.gz
rneovim-08b8fe5ab36ee3df3ce593942565d4cd318373c4.tar.bz2
rneovim-08b8fe5ab36ee3df3ce593942565d4cd318373c4.zip
vim-patch:9.2.0030: completion: non-prefix matches shown when leader is NULL
Problem: When 'autocomplete' fires before compl_leader is initialized, the prefix filter is bypassed. This allows non-prefix matches (e.g. from fuzzy omnifuncs) to be shown in the popup menu and incorrectly preinserted. Solution: In get_leader_for_startcol(), if compl_leader.string is NULL, fall back to using compl_orig_text as a filter for matches starting at or after the completion column (Hirohito Higashi). 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. fixes: vim/vim#19328 closes: vim/vim#19447 https://github.com/vim/vim/commit/a04ae0210b18795d05d26609b6ba9fb9bf88caff Co-authored-by: Hirohito Higashi <h.east.727@gmail.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'runtime/lua/vim/provider/python.lua')
0 files changed, 0 insertions, 0 deletions