Problem: cmdline-autocompletion breaks history navigation (ddad431)
Solution: Support history navigation in cmdline autocompletion (Girish
Palya)
Up/Down arrows support history navigation when using wildtrigger()
fixes: vim/vim#18207closes: vim/vim#18219708ab7f5fb
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: Matches may be listed twice with wildmode=longest,list when
"longest" doesn't change command line (after 9.1.1737).
Solution: Set did_wild_list when trying "list" after "longest"
(zeertzjq).
closes: vim/vim#18227a28a2eb9d9
Problem: Patch v9.1.1714 introduce a regression for wildmenu (zeertzjq)
Solution: Restore behavior of "longest" in 'wildmode' (Girish Palya)
- Fixed a regression caused by PR vim/vim#18125 selecting wrong item
- Fixed another regression where the first pasted text did not appear on
the command-line after starting Vim.
closes: vim/vim#182128fec92d631
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: completion: long line shown twice
(Maxim Kim)
Solution: Fix the issue, disable an incorrect test.
(Girish Palya)
fixes: vim/vim#18035closes: vim/vim#1808857379302aa
Omit removal of blank line in Test_noselect_expand_env_var() as it's
added again in patch 9.1.1682.
Cherry-pick two blank lines in Test_long_line_noselect() from patch
9.1.1682.
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: filetype: .inc file detection can be improved
Solution: Update filetype detection for Pascal and BitBake code
(Martin Schwan).
Fix the detection of .inc files containing Pascal and BitBake code:
- the concatenated string, merged from three lines, only contains one
beginning and the pattern "^" would not match as expected. Use a range()
loop to iterate each line string individually. This way, the pattern "^"
works for beginning of lines.
- improve BitBake include file detection by also matching forward-slashes
"/" in variable names and assignment operators with a dot ".=" and "=.".
Valid examples, which should match, are:
PREFERRED_PROVIDER_virtual/kernel = "linux-yocto"
MACHINEOVERRIDES =. "qemuall:"
BBPATH .= ":${LAYERDIR}"
- parse twenty instead of just three lines, to accommodate for potential
comments at the beginning of files
closes: vim/vim#182029fd1a657d2
Co-authored-by: Martin Schwan <m.schwan@phytec.de>
Problem: filetype: vivado journal/log files are not recognized
Solution: Detect vivado*.{jou,log} as tcl filetype (Wu Zhenyu).
closes: vim/vim#181919a6cafdc1c
Also fix missing anchor in the pattern from the port of patch 9.1.1602.
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem:
insert-mode ctrl-r input is treated like raw user input, which is almost
never useful. This means any newlines in the input are affected by
autoindent, etc., which is:
- slow
- usually breaks the formatting of the input
Solution:
- ctrl-r should be treated like a paste, not user-input.
- does not affect `<c-r>=`, so `<c-r>=@x` can still be used to get the
old behavior.
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Problem: tests: various tests can be improved
Solution: Use string interpolation to concatenate strings in
test_winfixbuf, check for specific errors in assert_fails()
(Yegappan Lakshmanan)
closes: vim/vim#1815197ea879b9b
Cherry-pick Test_file_perm.vim changes from patch 9.0.{0363,0611}.
Skip Test_colornames_assignment_and_unassignment().
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: filetype: fvwm2m4 files are no longer recognized
(after 9.1.1687).
Solution: Add a special case in m4 filetype detection (zeertzjq).
closes: vim/vim#181465355e81868
Co-authored-by: Damien Lejay <damien@lejay.be>
Problem: tests: no test for aclocal.m4
(after v9.1.1693)
Solution: Add a test that aclocal.m4 is detected as config filetype
related: vim/vim#18065f5670a1596
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test_filetype fails in shadow dir
(after v9.1.9.1.1687)
Solution: Use a custom test that does not rely on configure.ac
being existing in the upper directory tree.
de6e560150
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: a pattern that involves a backref on a different line does not
match when 'ignorecase' is set (QiWei, after v9.1.0645)
Solution: Use MB_STRNICMP when ignorecase is set, fix tests to close
swapfiles
related: vim/vim#14756fixes: vim/vim#17470closes: vim/vim#18104bf82e58a70
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test_edit still fails on CI
(after v9.1.1701)
Solution: Fix the skip condition
42acf736a3
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: tests: failure on CI with GUI and ASAN in test_edit.res
(Hirohito Higashi)
Solution: Disable the test for that specific situation in CI, close
swapfiles
fixes: vim/vim#180706c14c4625b
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Need more Vim script specific tests
Solution: Add more tests (Yegappan Lakshmanan).
closes: vim/vim#18118e810ba5a1f
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: CmdlineChanged not triggered by <Del>
Solution: Use STRCMP() instead of STRNCMP()
(Shougo Matsushita)
closes: vim/vim#18101540480697d
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Problem: FEAT_TEXT_PROP is a confusing name.
Solution: Use FEAT_PROP_POPUP. (Naruhiko Nishino, closesvim/vim#5291)
05ad5ff0ab
textprop,popuwin remain N/A features.
getchar.c has the relevant code changes.
Port runtest.vim changes from patch v8.1.1561.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: tests: no test for actually moving cursor when menu is not
open with 'autocompletedelay'.
Solution: Use <Up> first in the test. Also remove two unnecessary <Esc>s
in completion timeout test (zeertzjq).
closes: vim/vim#18097e8b99ff6d5
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: vim/vim#17960a09b1604d4
N/A patch: vim-patch:9.1.1641: a few compiler warnings are output
Co-authored-by: Girish Palya <girishji@gmail.com>
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: vim/vim#180896b56711804
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: vim/vim#180270c4405a6b2
Co-authored-by: WuJunkai2004 <wujunkai20041123@outlook.com>
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: vim/vim#17990c08b94b072
Co-authored-by: David Friant <friant@HPEnvyx360.friant.dev>
Problem: Buffer menu does not handle unicode names correctly
(after v9.1.1622)
Solution: Fix the BMHash() function (Yee Cheng Chin)
The Buffers menu uses a BMHash() function to generate a sortable number
to be used for the menu index. It used a naive (and incorrect) way of
encoding multiple ASCII values into a single integer, but assumes each
character to be only in the ASCII 32-96 range. This means if we use
non-ASCII file names (e.g. Unicode values like CJK or emojis) we get
integer underflow and overflow, causing the menu index to wrap around.
Vim's GUI implementations internally use a signed 32-bit integer for the
`gui_mch_add_menu_item()` function and so we need to make sure the menu
index is in the (0, 2^31-1) range.
To do this, if the file name starts with a non-ASCII value, we just use
the first character's value and set the high bit so it sorts after the
other ASCII ones. Otherwise, we just take the first 5 characters, and
use 5 bit for each character to encode a 30-bit number that can be
sorted.
This means Unicode file names won't be sorted beyond the first
character. This is likely going to be fine as there are lots of ways to
query buffers.
related: vim/vim#17403closes: vim/vim#179288f9de4991e
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
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: vim/vim#17992891353671a
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#34101fixesvim/vim#17531closes: vim/vim#179007e0df5eee9
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: C-indent does not handle compound literals
(@44100hertz, @Jorenar)
Solution: Detect and handle compound literal and structure
initialization (Anttoni Erkkilä)
match '=' or "return" optionally followed by &, (typecast), {
Fixes also initialization which begins with multiple opening braces.
fixes: vim/vim#2090fixes: vim/vim#12491closes: vim/vim#178655ba6e41d37
Co-authored-by: Anttoni Erkkilä <anttoni.erkkila@protonmail.com>
Problem: Patch v9.1.1432 causes performance regressions
Solution: Revert "patch 9.1.1432: GTK GUI: Buffer menu does not handle
unicode correctly" (Yee Cheng Chin).
This reverts commit 08896dd330c6dc8324618fde482db968e6f71088.
The previous change to support Unicode characters properly in the
buffers menu resorted to removing all buffer menus and re-add the
buffers after doing a sort, per each buffer addition. This was quite
slow because if Vim is trying to load in multiple buffers at once (e.g.
when loading a session) this scales in O(n^2) and Vim can freeze for
dozens of seconds when adding a few hundred buffers.
related: vim/vim#17405
related: vim/vim#17928fixes: vim/vim#17897cda0d17f59
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem: Incorrect E535 error message (after 9.1.1603).
Solution: Don't use transchar(), as the character is always printable
(zeertzjq).
closes: vim/vim#17948b362995430
Problem: completion: incorrect selected index returned from
complete_info()
Solution: Return the index into "items" and restore the previous
behaviour (Robert Muir).
complete_info() returned an incorrect selected index after
0ac1eb3555445f4c458c06cef7c411de1c8d1020 (Patch v9.1.1311). Effectively
it became an index into "matches" instead of "items". Return the index
into "items" by default to restore the previous behavior, unless
"matches" was requested.
closes: vim/vim#179528e2a229189
Co-authored-by: Robert Muir <rmuir@apache.org>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Problem: tests: test_search leaves a few swapfiles behind
Solution: Use :bw! instead of :close to close the swapfile at the end of
the test.
related: vim/vim#17933a2bb21a895
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Ctrl-G/Ctrl-T does not ignore the end search delimiter
(irisjae)
Solution: Check if the pattern ends with a search delimiter and ignore
it, unless it is part of the pattern.
fixes: vim/vim#17895closes: vim/vim#17933c03990d30f
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: diff format erroneously detected
(Tomáš Janoušek)
Solution: Make the regex to detect normal diff format a bit stricter,
while at it, fix wrong test content from patch v9.1.1606
fixes: vim/vim#17946887b4981e7
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: a few more files are not recognized
Solution: guess Mail, Info and Terminfo files by its content
(lacygoill)
closes: vim/vim#17880eb2aebeb79
Co-authored-by: lacygoill <lacygoill@lacygoill.me>
Problem: completion: cannot use autoloaded funcs in 'complete' F{func}
(Maxim Kim)
Solution: Make it work (Girish Palya)
fixes: vim/vim#17869closes: vim/vim#178851bfe86a7d3
Cherry-pick Test_omni_autoload() from patch 8.2.3223.
Co-authored-by: Girish Palya <girishji@gmail.com>