]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.1.1435: completion: various flaws in fuzzy completion v9.1.1435
authorGirish Palya <girishji@gmail.com>
Thu, 5 Jun 2025 19:04:29 +0000 (21:04 +0200)
committerChristian Brabandt <cb@256bit.org>
Thu, 5 Jun 2025 19:09:24 +0000 (21:09 +0200)
commit8cd42a58b49c948ab59ced6ca5f5ccfae5d9ecea
treecad54d51d067bb14773b7aac347cda70f4ef949f
parent738df3887f73ab2b3c87b30d41fb9c27a7bb3022
patch 9.1.1435: completion: various flaws in fuzzy completion

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: #17387
closes: #17430

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/insexpand.c
src/misc2.c
src/proto/misc2.pro
src/structs.h
src/testdir/test_ins_complete.vim
src/version.c