A file containing only async functions (`async def func()`) wouldn't
previously match the pythonSync pattern.
Also, this pattern only matches at the beginning of the line, so it
won't ever match method definitions (which are indented within class
scopes). Update the comment accordingly.
closes: #17963
Signed-off-by: Jon Parise <jon@indelible.org>
Signed-off-by: Zvezdan Petkovic <zpetkovic@acm.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Highlight f-string replacement fields, including
- Comments
- Debugging flags
- Conversion fields
- Format specifications
- Delimiters
Syntax inside fields will be addressed in a separate commit.
related: #10734
related: #14033closes: #17784
Signed-off-by: Rob B <github@0x7e.net>
Signed-off-by: Zvezdan Petkovic <zpetkovic@acm.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Class and function definitions previously shared a single highlight
group (pythonFunction). This change gives classes their own highlight
group (pythonClass) that's linked to Structure.
closes: #17856
Signed-off-by: Jon Parise <jon@indelible.org>
Signed-off-by: Zvezdan Petkovic <zpetkovic@acm.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
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: #17403closes: #17928
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
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: #17405
related: #17928fixes: #17897
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When the popup menu (PUM) occupies more than half the screen
height, it flickers whenever a character is typed or erased.
This happens because the PUM is cleared and the screen is
redrawn before a new PUM is rendered. The extra redraw between
menu updates causes visible flicker.
Solution: A complete, non-hacky fix would require removing the
CmdlineChanged event from the loop and letting autocompletion
manage the process end-to-end. This is because screen redraws
after any cmdline change are necessary for other features to
work.
This change modifies wildtrigger() so that the next typed
character defers the screen update instead of redrawing
immediately. This removes the intermediate redraw, eliminating
flicker and making cmdline autocompletion feel smooth
(Girish Palya).
Trade-offs:
This behavior change in wildtrigger() is tailored specifically for
:h cmdline-autocompletion. wildtrigger() now has no general-purpose use
outside this scenario.
closes: #17932
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: composer.lock and symfony.lock files not recognized
Solution: Detect composer.lock and symfony.lock files as json filetype
(Dietrich Moerman)
closes: #17945
Signed-off-by: Dietrich Moerman <dietrich.moerman@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Incorrect E535 error message (after 9.1.1603).
Solution: Don't use transchar(), as the character is always printable
(zeertzjq).
closes: #17948
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Reformat parts to fit into 80 column window.
- Fix example with mandatory call with a range.
https://github.com/vim/vim/discussions/17950#discussioncomment-14055687
- Remove some duplicate information
closes: #17949
Signed-off-by: veotos <veotos@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
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: #17952
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Robert Muir <rmuir@apache.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim9: some error messages can be improved
Solution: Improve error messages when parsing generic function type
arguments (Yegappan Lakshmanan).
closes: #17957
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: xxd: possible buffer overflow with bitwise output
(after v9.1.1459, Xudong Cao)
Solution: Update LLEN_NO_COLOR macro definition for the max line output
(using bitwise output -b)
fixes: #17944closes: #17947
Signed-off-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: #17946
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim9: possible variable type change when using closure in a
for loop (Maxim Kim)
Solution: Use unwind_locals(..., TRUE) (Yegappan Lakshmanan)
fixes: #17844closes: #17951
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
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: #17933
Signed-off-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: #17895closes: #17933
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: possible undefined behaviour in mb_decompose(), when using the
same pointer as argument several times
Solution: use separate assignments to avoid reading and writing the same
object at the same time (Áron Hárnási)
closes: #17953
Signed-off-by: Áron Hárnási <aron.harnasi@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Match &option, and &[lg]:option variables.
- Match Ex commands after :bar.
- Fix matching of pre and post context text.
- Style - use '..' for string concatenation.
fixes#17567closes: #17653
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This brings the upstream files to commit 9dc3bd3 (ftplugin: escape Vim
special characters when opening docs, 2025-08-09). Note that not all
upstream files are included.
closes: #17956
Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Commit 22fc41f1f7c94fca491b6759e49ac2430f0b81a2 used wmic to generate
the year, however it may not always be available. So use Powershell
directly.
related: #17855closes: #17955
Signed-off-by: RestorerZ <restorer@mail2k.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: completion: hang (after 9.1.1471) or E684 (after 9.1.1410)
when 'tagfunc' calls complete().
Solution: Check if complete() has been called immediately after getting
matches instead of in the next loop iteration (zeertzjq).
related: #1668
related: neovim/neovim#34416
related: neovim/neovim#35163closes: #17929
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: complete: Heap-buffer overflow with complete function
(zeertzjq)
Solution: Do not let startcol become negative (Girish Palya).
fixes: #17907closes: #17934
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-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: #17880
Signed-off-by: lacygoill <lacygoill@lacygoill.me>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: completion: incsearch highlight might be lost after search
completion (Hirohito Higashi)
Solution: Restore incsearch highlight after dismissing pum with Ctrl-E
(Girish Palya)
related: #17870closes: #17891
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When the parameter debug=msg is set and the command :option is
entered, error E94 will be displayed.
Solution: Add a check for the existence of the buffer before getting the
buffer number “option-window”.
Reproduce:
vim --clean -c "set debug=msg" -c "option"
Error detected while processing command line..script D:\Programs\Vim\vim91\optwin.vim:
line 9: E94: No matching buffer for option-window
closes: #17927
Signed-off-by: RestorerZ <restorer@mail2k.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: completion: cannot use autoloaded funcs in 'complete' F{func}
(Maxim Kim)
Solution: Make it work (Girish Palya)
fixes: #17869closes: #17885
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim's help file doesn't have any syntax for comments, but
'comments' and 'commentstring' are still set in the help
buffer.
Solution: Unset 'comments' and 'cms' in help buffer
closes: #17889
Signed-off-by: Phạm Bình An <111893501+brianhuster@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Patch v8.1.0425 was wrong
Solution: Revert that patch (Hirohito Higashi)
This is because the root cause was fixed in 8.1.0786 and a regression
occurred elsewhere.
related: #3455
related: #3830fixes: #11558closes: #17899
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Correct expression syntax to match case in if and if-else clauses.
related: #8535closes: #17901
Signed-off-by: veotos <veotos@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: diff: using diff anchors with hidden buffers fails silently
Solution: Give specific error message for diff anchors when using hidden
buffers (Yee Cheng Chin).
Diff anchors currently will fail to parse if a buffer used for diff'ing
is hidden. Previously it would just fail as the code assumes it would
not happen normally, but this is actually possible to do if `closeoff`
and `hideoff` are not set in diffopt. Git's default diff tool "vimdiff3"
also takes advantage of this.
This fix this properly would require the `{address}` parser to be
smarter about whether a particular address relies on window position or
not (e.g. the `'.` address requires an active window, but `'a` or `1234`
do not). Since hidden diff buffers seem relatively niche, just provide a
better error message / documentation for now. This could be improved
later if there's a demand for it.
related: #17615closes: #17904
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>