]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.1.1512: completion: can only complete from keyword characters v9.1.1512
authorGirish Palya <girishji@gmail.com>
Sat, 5 Jul 2025 14:11:44 +0000 (16:11 +0200)
committerChristian Brabandt <cb@256bit.org>
Sat, 5 Jul 2025 14:11:44 +0000 (16:11 +0200)
commitba11e78f1d5342786faed0ebd5b09ffee7f7ff86
treebbaf0a3c2552cea65f50599b269629acf06ac121
parent96076bf41e0163cd61ca738b352896d450ee3636
patch 9.1.1512: completion: can only complete from keyword characters

Problem:  completion: can only complete from keyword characters
Solution: remove this restriction, allow completion functions when
          called from i_CTRL-N/i_CTRL-P to be triggered from non-keyword
          characters (Girish Palya)

Previously, functions specified in the `'complete'` option were
restricted to starting completion only from keyword characters (as
introduced in PR 17065). This change removes that restriction.

With this change, user-defined functions (e.g., `omnifunc`, `userfunc`)
used in `'complete'` can now initiate completion even when triggered
from non-keyword characters. This makes it easier to reuse existing
functions alongside other sources without having to consider whether the
cursor is on a keyword or non-keyword character, or worry about where
the replacement should begin (i.e., the `findstart=1` return value).

The logic for both the “collection” and “filtering” phases now fully
respects each source’s specified start column. This also extends to
fuzzy matching, making completions more predictable.

Internally, this builds on previously merged infrastructure that tracks
per-source metadata. This PR focuses on applying that metadata to
compute the leader string and insertion text appropriately for each
match.

Also, a memory corruption has been fixed in prepare_cpt_compl_funcs().

closes: #17651

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/insert.txt
runtime/doc/options.txt
src/insexpand.c
src/testdir/test_ins_complete.vim
src/version.c