0
0
mirror of https://github.com/vim/vim.git synced 2025-10-20 08:14:18 -04:00
Commit Graph

19861 Commits

Author SHA1 Message Date
Hirohito Higashi
e2a6ba00f1 patch 9.1.1673: if_python: still support for Python 1
Problem:  if_python: still support for Python 1
Solution: Drop outdated code (Hirohito Higashi)

closes: #18092

Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-23 16:31:15 +02:00
Girish Palya
69a337edc1 patch 9.1.1672: completion: cannot add timeouts for 'cpt' sources
Problem:  completion: cannot add timeouts for 'cpt' sources
          (Evgeni Chasnovski)
Solution: Add the 'autocompletetimeout' and 'completetimeout' options
          (Girish Palya)

fixes: #17908
closes: #17967

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-23 16:20:03 +02:00
Damien Lejay
6a37035bf2 patch 9.1.1671: configure: missing comment about AC_CONFIG_SRCDIR
Problem:  configure: missing comment about AC_CONFIG_SRCDIR
Solution: Add comment explaining the use of AC_CONFIG_SRCDIR
          (Damien Lejay)

closes: #18071

Signed-off-by: Damien Lejay <damien@lejay.be>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-23 06:43:27 -04:00
Girish Palya
b4e0bd93a9 patch 9.1.1670: completion: autocomplete breaks second completion
Problem:  completion: autocomplete breaks second completion
          (gravndal)
Solution: Fix the autocomplete bug (Girish Palya)

fixes: #18044
closes: #18068

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-23 06:36:00 -04:00
Yegappan Lakshmanan
454c7ea484 patch 9.1.1669: Vim script: no support for URI de-/encoding
Problem:  Vim script: no support for URI de-/encoding
          (ubaldot)
Solution: Add the uri_encode() and uri_decode() functions
          (Yegappan Lakshmanan)

fixes: #17861
closes: #18034

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-23 06:26:16 -04:00
Yegappan Lakshmanan
da34f84847 patch 9.1.1668: items() does not work for Blobs
Problem:  items() does not work for Blobs
Solution: Extend items() to support Blob
          (Yegappan Lakshmanan).

closes: #18080

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-23 06:18:34 -04:00
zeertzjq
6b56711804 patch 9.1.1667: Another outdated comment in eval.c
Problem:  Another outdated comment in eval.c (after 9.1.1665).
Solution: Remove that comment as well. Add a few more tests for mapnew()
          that fail without patch 8.2.1672 (zeertzjq).

closes: #18089

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-23 06:10:23 -04:00
Foxe Chen
5734afebab patch 9.1.1666: no support for terminal primary device attributes
Problem:  no support for terminal primary device attributes
Solution: Add support for detecting the DA1 response from the terminal,
          add the v:termda1 variable and the 't_Ms' option for the
          OSC 52 command format (Foxe Chen)

closes: #18033

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-23 06:00:23 -04:00
zeertzjq
5d3c39af2a patch 9.1.1665: Outdated comment in eval.c
Problem:  Outdated comment in eval.c.
Solution: Remove the comment, which is no longer true after 8.2.1672.
          Also fix a typo in version9.txt (zeertzjq).

closes: #18077

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-22 12:47:15 -04:00
Damien Lejay
ea3d465438 patch 9.1.1664: configure: can use any autoconf
Problem:  configure: can use any autocon
Solution: Use AC_PREREQ and require 2.71 (Damien Lejay)

technically, we require autoconf 2.72, but that is not available on
Ubuntu LTS 24.04. So let's go with 2.71 for now and add a comment about
it in configure.ac

closes: #18047

Signed-off-by: Damien Lejay <damien@lejay.be>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-22 12:38:12 -04:00
David Seal
836ed5271e patch 9.1.1663: xxd: 9.1.0023 introduced additional dependency
Problem:  xxd: 9.1.0023 introduced additional dependency
Solution: remove non-native z/OS library call (David Seal)

Commit 48a75f3dfb (Patch 9.1.0023)
introduces a call to __disableautocvt() which can only be found in a
non-native z/OS library.  This requires installing the external zoslib
library in order to work, which is not present on all z/OS systems

So remove the call to __disableautocvt() and rely on library routines
that are available to all z/OS users

See https://ibmruntimes.github.io/zoslib/zos-io_8cc.html for more
details

closes: #18059

Signed-off-by: David Seal <dseal@rocketsoftware.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-20 22:24:56 +02:00
Hirohito Higashi
d839a5b3b0 patch 9.1.1662: Issues with proto files: missing or inconsistent prototypes.
Problem:  Issues with proto files: missing or inconsistent prototypes.
Solution: Update ifdefs, move typedefs, fix prototype declaration
          (Hirohito Higashi)

This change focuses on fixes and tweaks found while working on #18045 for
the proto/*.pro files.

The following fixes and tweaks have been made:

- Fixed a prototype declaration where the variable name differed from
  the function definition.
- Removed a prototype declaration without a function body.
- Fixed a problem where a prototype declaration was not created for a
  function definition enclosed in a #if directive because it lacked ||
  defined(PROTO).
- Moved typedef struct soundcb_S soundcb_T; from proto/sound.pro to
  vim.h.
- Other small tweaks.

The make proto mechanism remains unchanged.

closes: #18058

Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-20 22:08:13 +02:00
Foxe Chen
c0a3eda6ba patch 9.1.1661: Coverity finds a few issues in clientserver.c
Problem:  Coverity finds a few issues in clientserver.c
          (also by Tony Mechelynck)
Solution: Fix issues and warnings (Foxe Chen)

closes: #18057

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-20 22:00:41 +02:00
glepnir
38315295ef patch 9.1.1660: popups without decoration are positioned wrong at bottom of screen
Problem:  Popups without border/padding/title don't flip position when
          cursor is near bottom of screen, while decorated popups do
          flip correctly.
Solution: Use original height instead of truncated height for position
          inversion check, except for info popups to preserve existing
          behavior (glepnir).

fixes: #12546
closes: #18054

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-20 21:43:15 +02:00
Damien Lejay
bb1233d328 patch 9.1.1659: configure: uses AC_INIT without args
Problem:  configure: uses AC_INIT without args
Solution: Add a comment explaining why AC_INIT has no args
          (Damien Lejay)

closes: #18053

Signed-off-by: Damien Lejay <damien@lejay.be>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-20 21:29:54 +02:00
Christoffer Aasted
bb26f709ea patch 9.1.1658: Missing includes for Wayland headers
Problem:  Missing includes for Wayland headers, when subfolder is used
          (after v9.1.1644)
Solution: Add new $WAYLAND_CPPFLAGS (Christoffer Aasted).

closes: #18051

Signed-off-by: Christoffer Aasted <dezzadk@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-20 21:21:57 +02:00
Girish Palya
196c376682 patch 9.1.1657: Autocompletion adds delay
Problem:  Autocompletion adds delay
          (gcanat, char101, after v9.1.1638)
Solution: Temporarily disable autocomplation (Girish Palya).

related: #17960
fixes: #18022
closes: #18048

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-20 21:20:01 +02:00
Christian Brabandt
17b4c7cfa2 patch 9.1.1656: MS-Windows: Patch v9.1.1652 breaks clipboard
Problem:  MS-Windows: Patch v9.1.1652 breaks clipboard
          (ddad431, after v9.1.1652)
Solution: Revert the patch

Revert "patch 9.1.1652: cannot determine non-X11/Wayland clipmethods"

This reverts commit 3e152c76ad.

fixes: #18064

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-20 21:07:07 +02:00
Christian Brabandt
3e44fbf316 patch 9.1.1655: Build-failure in do_mouse()
Problem:  Build-failure in do_mouse()
          (after v9.1.1653)
Solution: Add missing closing paren

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-20 20:56:53 +02:00
Christian Brabandt
e1a435c508 patch 9.1.1654: build failure when FEAT_DIFF is not defined
Problem:  build failure when FEAT_DIFF is not defined
          (John Marriott)
Solution: Remove FEAT_DIFF in proto.h; define dummy type for
          diffline_T and diffline_change_T when FEAT_DIFF is not defined

related: #18026
closes: #18046

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-20 20:37:37 +02:00
Christian Brabandt
2fd9ac7a69 patch 9.1.1653: Coverity complains about Null pointer dereference
Problem:  Coverity complains about Null pointer dereference
          (after v9.1.1643)
Solution: Check that TabPageIdx is not Null

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-20 20:31:08 +02:00
Antonio Giovanni Colombo
aabcca3655 translation(it): Update Italian translation
Signed-off-by: Antonio Giovanni Colombo <azc100@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-20 20:27:11 +02:00
Foxe Chen
3e152c76ad patch 9.1.1652: cannot determine non-X11/Wayland clipmethods
Problem:  Cannot determine non-X11/Wayland clipmethods
Solution: Add the "gui" value to the 'clipmethod' option (Foxe Chen)

closes: #18006

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-18 22:09:27 +02:00
Foxe Chen
96b2154b73 patch 9.1.1651: Cannot use clientserver over socket
Problem:  Cannot use clientserver over Unix domain socket
Solution: Implement socketserver functionality (Foxe Chen).

fixes: #3509
closes: #17839

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-18 21:40:40 +02:00
glepnir
31170af24a patch 9.1.1650: popup: window may not properly resize
Problem:  After scrolling a popup and then using popup_settext() with
          fewer lines, the popup fails to resize properly because
          firstline points beyond the new buffer content (lifepillar)
Solution: In popup_adjust_position(), validate that firstline doesn't
          exceed buffer line count and reset to 0 (auto-position) if it
          does (glepnir)

fixes: #14745
closes: #18031

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-18 21:16:42 +02:00
glepnir
c7c10f8c11 patch 9.1.1649: attrs allocation and fuzzy growarray could leak
Problem:  attrs allocation and fuzzy growarray could leak on early
          returns
Solution: Ensure proper cleanup of allocated memory on exit paths
          (glepnir)

closes: #18038

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-18 21:09:18 +02:00
zeertzjq
14afa278c1 patch 9.1.1648: MS-Windows: some style issues with patch v9.1.1646
Problem:  MS-Windows: some style issues with patch v9.1.1646
Solution: Fix typose and code style issues (zeertzjq).

closes: #18036

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-18 21:02:45 +02:00
WuJunkai2004
0c4405a6b2 patch 9.1.1647: filetype: Cangjie files are not recognized
Problem:  filetype: Cangjie files are not recognized
Solution: Detect *.cj files as cangjie filetype, include a syntax plugin
          (WuJunkai2004)

This commit introduces a new syntax highlighting file for the Cangjie
programming language, includes 4 parts as required:
- The main syntax file: runtime/syntax/cangjie.vim
- The filetype detection rule in: runtime/filetype.vim
- The documentation update in: runtime/doc/syntax.txt
- Some menus

References:
- https://gitcode.com/Cangjie
- https://cangjie-lang.cn/

fixes: 18014
closes: #18027

Signed-off-by: WuJunkai2004 <wujunkai20041123@outlook.com>
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-18 20:53:34 +02:00
Miguel Barro
a2f13bf782 patch 9.1.1646: MS-Windows: completion cannot handle implicit drive letters
Problem:  MS-Windows: completion cannot handle implicit drive letters
Solution: Consider paths like \folder and /folder as absolute
          (Miguel Barro).

closes: #17829

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Miguel Barro <miguel.barro@live.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-17 22:10:31 +02:00
glepnir
59799f3afa patch 9.1.1645: fuzzy.c can be further improved
Problem:  fuzzy.c can be further improved
Solution: Fix memory leak and refactor it (glepnir).

Optimize performance and memory allocation:

- Fix memory leak in fuzzy_match_in_list.
- using single memory allocation in match_positions
- Improve has_match performance and add null pointer checks

closes: #18012

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-17 21:40:45 +02:00
Damien Lejay
ce288c7fb0 patch 9.1.1644: configure: doesn't separate CPPFLAGS and CFLAGS
Problem:  configure: doesn't separate CPPFLAGS and CFLAGS
Solution: Split CPPFLAGS and CFLAGS for pkg-config
          (Damien Lejay)

Previously, all flags returned by pkg-config --cflags were dumped into
CFLAGS, mixing include paths with compiler options. This commit uses
--cflags-only-I and --cflags-only-other to properly separate include
flags into CPPFLAGS and keep compiler flags in CFLAGS.

closes: #18019

Signed-off-by: Damien Lejay <damien@lejay.be>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-17 21:25:07 +02:00
Hirohito Higashi
20a159b557 patch 9.1.1643: tabpanel: mouse code too complicated
Problem:  tabpanel: mouse code too complicated
Solution: Refactor code, adjust ifdefs (Hirohito Higashi).

closes: #18023

Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-17 21:09:56 +02:00
Damien Lejay
0ebe55af54 patch 9.1.1642: configure: wrong C99 feature test
Problem:  configure: wrong C99 feature test
Solution: Update inverted C99 feature test logic
          (Damien Lejay)

closes: #18024

Signed-off-by: Damien Lejay <damien@lejay.be>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-17 21:06:59 +02:00
Yegappan Lakshmanan
486cffab3e patch 9.1.1641: a few compiler warnings are output
Problem:  a few compiler warnings are output
Solution: Fix compiler warnings (Yegappan Lakshmanan)

closes: #18025

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-17 21:02:44 +02:00
David Friant
c08b94b072 patch 9.1.1640: Unicode has deprecated some code-points
Problem:  Unicode has deprecated some code-points
Solution: Update the digraph tables to align with the Unicode v16
          release (David Friant)

This commit updates the digraphs Left-Pointing Angle Bracket '</'
and Right-Pointing Angle Bracket '/>' to account for the fact that
the old Unicode codepoints for them (2329 and 232A, respectively)
have been deprecated. As per the Miscellaneous Technical code chart
(https://www.unicode.org/charts/PDF/U2300.pdf), the old digraphs
have been reassigned to the CJK Left Angle Bracket and Right Angle
Bracket (3008 and 3009) with their declaration moved to the
appropriate block.

This commit also introduces the new digraphs '<[' and ']>' to
represent the Mathematical Left Angle Bracket and Mathematical
Right Angle Bracket (27E8 and 27E9) to replace the deprecated code
points in the Technical block.

Tests have been added and, I believe, the documentation has been
updated accordingly.

closes: #17990

Signed-off-by: David Friant <friant@HPEnvyx360.friant.dev>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-16 18:33:05 +02:00
Girish Palya
1e38198a41 patch 9.1.1639: completion: popup may be misplaced
Problem:  During commandline completiom, popup window placement can be
          incorrect when 'noselect' is present in 'wildmode'
          (Shane-XB-Qian)
Solution: Disable "showtail" feature when 'noselect' is present.

fixes: #17969
closes: #18001

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-16 18:13:46 +02:00
Girish Palya
a09b1604d4 patch 9.1.1638: completion: not possible to delay the autcompletion
Problem:  completion: not possible to delay the autcompletion
Solution: add the 'autocompletedelay' option value (Girish Palya).

This patch introduces a new global option 'autocompletedelay'/'acl' that
specifies the delay, in milliseconds, before the autocomplete menu
appears after typing.

When set to a non-zero value, Vim waits for the specified time before
showing the completion popup, allowing users to reduce distraction from
rapid suggestion pop-ups or to fine-tune the responsiveness of
completion.

The default value is 0, which preserves the current immediate-popup
behavior.

closes: #17960

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-16 18:04:04 +02:00
Yegappan Lakshmanan
3281a0ae62 patch 9.1.1637: FEAT_DIFF used in diff.pro
Problem:  FEAT_DIFF used in diff.pro
Solution: Remove it from the diff protocol file
          (Yegappan Lakshmanan)

closes: #18005

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-16 17:33:53 +02:00
Ivan Pešić
90f5d67840 translation(sr): Update Serbian messages translation
closes: #18009

Signed-off-by: Ivan Pešić <27575106+eevan78@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-16 17:28:19 +02:00
毛逸宁
3cee950fc9 runtime(diff): fix mixed translations in zh_CN
some translations confused zh_CN and zh_TW

Signed-off-by: 毛逸宁 <mao.yining@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-16 17:22:36 +02:00
Yegappan Lakshmanan
d6a762fe1b patch 9.1.1636: style issues
Problem:  style issues
Solution: Fix indentation of function parameters exceeding 80 character
          length (Yegappan Lakshmanan).

closes: #18013

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-16 16:26:54 +02:00
Naruhiko Nishino
62f5be6ea6 patch 9.1.1635: tabpanel: cannot drag inactive tabs
Problem:  tabpanel: cannot drag inactive tabs (char101)
Solution: use end_visual_mode_keep_button() instead of end_visual_mode()
          (Naruhiko Nishino)

fixes: #17986
closes: #18016

Signed-off-by: Naruhiko Nishino <naru123456789@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-16 16:09:02 +02:00
Foxe Chen
126bc4690f patch 9.1.1634: Clipboard code can be improved
Problem:  Clipboard code can be improved
Solution: Slightly refactor code (Foxe Chen).

This commit does the following:
-  Use garray_T when receiving data instead of manually reallocing
-  formatting fixes
-  skip Wayland test that requires clientserver if x11 not compiled
-  Make some functions static

closes: #17999

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-14 22:09:45 +02:00
zeertzjq
ade0815856 patch 9.1.1633: Search pattern shown incorrectly with negative offset
Problem:  Search pattern shown incorrectly with negative offset.
          (lkintact)
Solution: Don't prepend a '+' sign to a negative offset (zeertzjq).

fixes: #17993
closes: #17994

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-14 21:19:37 +02:00
glepnir
03d6e06edd patch 9.1.1632: memory leak in fuzzy.c
Problem:  memory leak in fuzzy.c
Solution: Free fuzmatch, add a few minor refactors
          (glepnir)

fixes neovim CID 584055: fuzmatch leak when count becomes 0
Fix partial allocation failure cleanup in buffer expansion

closes: #17996

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-14 21:15:44 +02:00
Yegappan Lakshmanan
bb07b1ac14 patch 9.1.1631: proto files are outdated
Problem:  proto files are outdated
Solution: Regenerate proto files (Yegappan Lakshmanan)

closes: #17997

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-14 21:00:51 +02:00
zeertzjq
891353671a patch 9.1.1630: tests: fuzzy bufname completion test doesn't match successfully
Problem:  tests: fuzzy buffer name completion test doesn't match
          successfully (after 9.1.1627).
Solution: Update pattern to account for the change in case sensitivity.
          Also mark Test_search_stat_option() as flaky as it can still
          sometimes fail (zeertzjq).

closes: #17992

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-14 20:34:08 +02:00
Yegappan Lakshmanan
706b6f5867 patch 9.1.1629: Vim9: Not able to use more than 10 type arguments in a generic function
Problem:  Vim9: Not able to use more than 10 type arguments in a generic
          function
Solution: Initialize the types after reading all the type arg variable
          names (Yegappan Lakshmanan)

closes: #17981

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-13 22:39:37 +02:00
glepnir
17a6d696bd patch 9.1.1628: fuzzy.c has a few issues
Problem:  fuzzy.c has a few issues
Solution: Use Vims memory management, update style
          (glepnir)

Problem:
- Missing cleanup of lmatchpos lists causing memory leaks
- Missing error handling for list operations
- Use of malloc() instead of Vim's alloc() functions
- Inconsistent C-style comments
- Missing null pointer checks for memory allocation
- Incorrect use of vim_free() for list objects

Solution:
- Add proper cleanup of lmatchpos in done section using list_free()
- Set lmatchpos to NULL after successful transfer to avoid confusion
- Add error handling for list_append_tv() failures
- Replace malloc() with alloc() and add null pointer checks
- Convert C-style comments to C++ style for consistency
- Fix vim_free() calls to use list_free() for list objects

closes: #17984

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-13 22:02:30 +02:00
Girish Palya
7e0df5eee9 patch 9.1.1627: fuzzy matching can be improved
Problem:  fuzzy-matching can be improved
Solution: Implement a better fuzzy matching algorithm
          (Girish Palya)

Replace fuzzy matching algorithm with improved fzy-based implementation

The
[current](https://www.forrestthewoods.com/blog/reverse_engineering_sublime_texts_fuzzy_match/)
fuzzy matching algorithm has several accuracy issues:

* It struggles with CamelCase
* It fails to prioritize matches at the beginning of strings, often
  ranking middle matches higher.

After evaluating alternatives (see my comments
[here](https://github.com/vim/vim/issues/17531#issuecomment-3112046897)
and
[here](https://github.com/vim/vim/issues/17531#issuecomment-3121593900)),
I chose to adopt the [fzy](https://github.com/jhawthorn/fzy) algorithm,
which:

* Resolves the aforementioned issues.
* Performs better.

Implementation details

This version is based on the original fzy
[algorithm](https://github.com/jhawthorn/fzy/blob/master/src/match.c),
with one key enhancement: **multibyte character support**.

* The original implementation supports only ASCII.
* This patch replaces ascii lookup tables with function calls, making it
  compatible with multibyte character sets.
* Core logic (`match_row()` and `match_positions()`) remains faithful to
  the original, but now operates on codepoints rather than single-byte
  characters.

Performance

Tested against a dataset of **90,000 Linux kernel filenames**. Results
(in milliseconds) show a **\~2x performance improvement** over the
current fuzzy matching algorithm.

```
Search String            Current Algo    FZY Algo
-------------------------------------------------
init                          131.759    66.916
main                          83.688     40.861
sig                           98.348     39.699
index                         109.222    30.738
ab                            72.222     44.357
cd                            83.036     54.739
a                             58.94      62.242
b                             43.612     43.442
c                             64.39      67.442
k                             40.585     36.371
z                             34.708     22.781
w                             38.033     30.109
cpa                           82.596     38.116
arz                           84.251     23.964
zzzz                          35.823     22.75
dimag                         110.686    29.646
xa                            43.188     29.199
nha                           73.953     31.001
nedax                         94.775     29.568
dbue                          79.846     25.902
fp                            46.826     31.641
tr                            90.951     55.883
kw                            38.875     23.194
rp                            101.575    55.775
kkkkkkkkkkkkkkkkkkkkkkkkkkkkk 48.519     30.921
```

```vim
vim9script

var haystack = readfile('/Users/gp/linux.files')

var needles = ['init', 'main', 'sig', 'index', 'ab', 'cd', 'a', 'b',
'c', 'k',
    'z', 'w', 'cpa', 'arz', 'zzzz', 'dimag', 'xa', 'nha', 'nedax',
'dbue',
    'fp', 'tr', 'kw', 'rp', 'kkkkkkkkkkkkkkkkkkkkkkkkkkkkk']
for needle in needles
    var start = reltime()
    var tmp = matchfuzzy(haystack, needle)
    echom $'{needle}' (start->reltime()->reltimefloat() * 1000)
endfor
```

Additional changes

* Removed the "camelcase" option from both matchfuzzy() and
  matchfuzzypos(), as it's now obsolete with the improved algorithm.

related: neovim/neovim#34101
fixes #17531
closes: #17900

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-08-12 22:22:52 +02:00