mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 01:46:29 +00:00
vim-patch:9.1.1435: completion: various flaws in fuzzy completion (#34335)
Problem: completion: various flaws in fuzzy completion
Solution: fix the issues (Girish Palya)
- Remove the brittle `qsort()` on `compl_match_array`.
- Add a stable, non-recursive `mergesort` for the internal doubly
linked list of matches.
- The sort now happens directly on the internal representation (`compl_T`),
preserving sync with external structures and making sorting stable.
- Update fuzzy match logic to enforce `max_matches` limits after
sorting.
- Remove `trim_compl_match_array()`, which is no longer necessary.
- Fixe test failures by correctly setting `selected` index and
maintaining match consistency.
- Introduce `mergesort_list()` in `misc2.c`, which operates generically
over doubly linked lists.
- Remove `pum_score` and `pum_idx` variables
fixes: vim/vim#17387
closes: vim/vim#17430
8cd42a58b4
Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
@@ -21,6 +21,10 @@ typedef void *(*MemCalloc)(size_t, size_t);
|
||||
/// `realloc()` function signature
|
||||
typedef void *(*MemRealloc)(void *, size_t);
|
||||
|
||||
typedef void *(*MergeSortGetFunc)(void *);
|
||||
typedef void (*MergeSortSetFunc)(void *, void *);
|
||||
typedef int (*MergeSortCompareFunc)(const void *, const void *);
|
||||
|
||||
#ifdef UNIT_TESTING
|
||||
/// When unit testing: pointer to the `malloc()` function, may be altered
|
||||
extern MemMalloc mem_malloc;
|
||||
|
Reference in New Issue
Block a user