Commit Graph

36056 Commits

Author SHA1 Message Date
bfredl
0ce48e7a9c fix(oldtests): move useful settings from ignored unix.vim
the unix.vim file was probably accidentally ignored at some point.
An actual invokation of nvim-under-test would in practice look like

  ["/path/to/neovim/build/bin/nvim", "-u", "unix.vim", "-U", "NONE", "-i", "NONE", "--noplugin", "--headless", "-u", "NONE", "--cmd", "set shortmess-=F", "-S", "runtest.vim", "test_arabic.vim"]

but -u NONE cancels out the earlier -u unix.vim

By now, too many tests rely on specific behavior from "NONE", so copy in
the useful parts of unix.vim to the cmdline again. also, some tests
conflict with `directory=.` (or even `directory=Xtempswapdir`) so don't use that.

`-U NONE` is dead code in Nvim, remove it.
2026-04-08 13:12:14 +02:00
Dan Drennan
65ef6cec1c fix(health): recognize Zig build optimization levels #38804
Problem: When Neovim is built with Zig, `:checkhealth` falsely reports
"Non-optimized debug build" for release builds. The extraction regex
stops at the first space, and the validation regex only lists CMake
build type names.

Solution: Fix the extraction regex to capture the full build type string
and add Zig optimization levels (ReleaseFast, ReleaseSafe, ReleaseSmall)
to the validation regex.

AI-assisted: Claude Code
2026-04-08 04:33:26 -04:00
glepnir
8603fc9180 fix(pum): crash with 'pumborder' and wide item (#38852)
Problem: pum_col goes negative when item width + border exceeds screen.

Solution: account for border_width in pum_compute_horizontal_placement()
instead of adjusting pum_col after the fact
2026-04-08 09:16:41 +08:00
zeertzjq
de67449180 Merge pull request #38864 from zeertzjq/vim-15e9888
vim-patch: runtime file updates
2026-04-08 07:38:53 +08:00
zeertzjq
399fe4a11f vim-patch:f3cba4a: runtime(doc): document gitcommit_summary_length
related: vim/vim#19905

f3cba4a205

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-08 07:23:20 +08:00
zeertzjq
87947a4e96 vim-patch:15e9888: runtime(bitbake): Update syntax script
1) add syntax for include_all

The include_all directive was introduced in [1]. It uses the same syntax
as include or require, taking one or more paths as argument.

2) add syntax for inherit_defer

The inherit_defer directive was introduced in [2]. It uses the same syntax
as inherit, taking one or more class name as argument.

3) add syntax for addpylib

The addpylib directive was introduced in [3]. It uses a syntax similar
to addtask or addhandler, taking a directory and python namespace as
argument.

[1]: https://git.openembedded.org/bitbake/commit/?id=d01d5593e7829ac60f37bc23cb87dc6917026471
[2]: https://git.openembedded.org/bitbake/commit/?id=5c2e840eafeba1f0f754c226b87bfb674f7bea29
[3]: https://git.openembedded.org/bitbake/commit/?id=afb8478d3853f6edf3669b93588314627d617d6b

15e988810e

Co-authored-by: Antonin Godard <antonin@godard.cc>
2026-04-08 07:22:58 +08:00
zeertzjq
5d66ef188f fix(rpc): trigger UILeave earlier on channel close (#38846)
Problem:
On exit, rpc_free() is called when processing main_loop.events after
libuv calls close callbacks of the channel's stream. However, when there
are no child processes, these libuv callbacks are called in loop_close()
instead of proc_teardown(), and main_loop.events isn't processed after
loop_close(). As a result, calling remote_ui_disconnect() in rpc_free()
causes UILeave to depend on the presence of child processes.

Solution:
Always call remote_ui_disconnect() in rpc_close_event(), and remove the
call in rpc_free().
2026-04-08 05:29:08 +08:00
luukvbaal
7fff91359e fix(message): flush messages before "empty" msg_show #38854
Problem:  When emitting a msg_show event with the "empty" kind,
          there may still be messages waiting to be emitted, which
          are then dropped as a result of recursion protection.
Solution: Flush messages before emitting "empty" message show.
2026-04-07 13:08:55 -04:00
Tomas Slusny
382a1c40c2 fix(difftool): ensure standardized locale for diff output parsing #38853
Always pass LC_ALL=C to diff when parsing its output.

Closes #38838

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
2026-04-07 13:02:11 -04:00
zeertzjq
2df2e72e0a fix(undo): undefined behavior with empty entry in 'undodir' (#38849)
Problem:  Undefined behavior when 'undodir' contains empty entry.
Solution: Don't try to remove trailing slashes from empty path. Also
          don't remove a colon on Windows while at it.
2026-04-07 14:49:05 +08:00
zeertzjq
6b0367481c fix: don't make path empty when truncating trailing slashes (#38844)
Fixes the following Coverity warning:

*** CID 549779:         Integer handling issues  (INTEGER_OVERFLOW)
/src/nvim/undo.c: 717             in u_get_undo_file_name()
711           dir_name[dir_len] = NUL;
712
713           // Remove trailing pathseps from directory name
714           char *p = &dir_name[dir_len - 1];
715           while (vim_ispathsep(*p)) {
716             *p-- = NUL;
>>>     CID 549779:         Integer handling issues  (INTEGER_OVERFLOW)
>>>     Expression "dir_len--", where "dir_len" is known to be equal to 0, underflows the type of "dir_len--", which is type "size_t".
717             dir_len--;
718           }
719
720           bool has_directory = os_isdir(dir_name);
721           if (!has_directory && *dirp == NUL && !reading) {
722             // Last directory in the list does not exist, create it.
2026-04-07 10:07:32 +08:00
zeertzjq
e94e469324 Merge pull request #38669 from SanzharKuandyk/fix-38667
fix(channel): fix Windows console regressions from #37977
2026-04-07 08:48:07 +08:00
zeertzjq
b36eafd5da vim-patch:794c304: runtime(doc): clarify incsearch feature and typed chars (#38830)
fixes: vim/vim#19886

794c304479

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-07 06:22:45 +08:00
zeertzjq
9d6453b771 vim-patch:9.2.0312: C-type names are marked as translatable (#38829)
Problem:  C-type names are marked as translatable
Solution: Use them as-is, do not translate them
          (Eisuke Kawashima)

closes: vim/vim#19861

a5b6c2d6e9

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2026-04-07 06:22:32 +08:00
glepnir
af707dd242 fix(diagnostic): virtual_lines should anchor at end_lnum, not lnum #38701
Problem: Multi-line diagnostics always render virtual lines below lnum.

Solution: Use end_lnum when placing the virt_lines extmark.
2026-04-06 13:22:39 -04:00
luukvbaal
1354787029 fix(cmdline): 'inccommand' preview after setcmdline() #38795
Problem:  'inccommand' preview is not executed after setcmdline(),
          and as a result cmdline_show event is emitted when redrawing
          is not allowed (5b6477be).
Solution: Call command_line_changed() when ccline.cmdbuff_replaced is
          set (by setcmdline()).
2026-04-06 13:15:46 -04:00
Christian Clason
bdc72a0843 feat(filetype): vim.filetype.inspect() returns copy of registry #38831
Problem: No way of inspecting the (user-added) filetype detection rules.

Solution: Add `vim.filetype.inspect()` returning copies of the internal
`extension`, `filename`, `pattern` tables. Due to the dynamic nature of
filetype detection, this will in general not allow getting the list of
known filetypes, but at least one can see if a given extension is known.
2026-04-06 12:48:42 -04:00
Josh Triplett
889572a358 fix(tui): check background color on resume #38726
Problem:
We normally get the background color via continuous reporting. However,
if we were backgrounded while the light/dark mode changed, we won't have
received the report, and we'll have the wrong background color.

Without this change, if you background nvim, toggle the light/dark mode,
resume, and check `:set bg`, it will not match the current state.

Solution:
Query it on resume as well. (This requires separating the query from the
flush, to just do the query along with all the others, while waiting to
flush until we've set up uv.)

With this change, if you background nvim, toggle the light/dark mode,
resume, and check `:set bg`, it will have updated.
2026-04-06 12:44:03 -04:00
Luis Calle
01be30f638 feat(vim.pos)!: require buf param on vim.pos, vim.range #38665
Problem: `buf` is optional even though its needed to perform conversions
and the ordering of `(buf, row, col)` is not consistent.

Solution: make `buf` mandatory on `vim.range` and `vim.pos` and enforce
the `buf, row, col` ordering
2026-04-06 11:51:36 -04:00
zeertzjq
595e58f47f vim-patch:f1dbca2: runtime(log): clean up and modernize log syntax (#38827)
- Rename groups to consistent log* naming (LogString→logString, etc.)
- Remove redundant logOperator/logBrackets, use logSymbol for special chars
- Simplify level keywords by removing case variants
- Consolidate syslog column patterns into logSysColumn
- Move custom highlights to portable ctermfg/guifg names
- Update maintainer email address

closes: vim/vim#19917

f1dbca200c

Co-authored-by: Mao-Yining <mao.yining@outlook.com>
2026-04-06 13:50:33 +00:00
zeertzjq
056304ef5b vim-patch:9.2.0306: runtime(tar): some issues with lz4 support (#38826)
Problem:  runtime(tar): some issues with lz4 support
Solution: Fix bugs (see below) (Aaron Burrow)

The tar plugin allows users to extract files from tar archives that are
compressed with lz4. But, tar#Extract() builds malformed extraction commands
for lz4-compressed tar archives. This commit fixes three issues in that code.
The first affects archives with a .tlz4 extension and the other two affect
archives with .tar.lz4 extension (but one of these is symmetric to the issue
that .tlz4 archives had).

(1) When trying to extract .tlz4 archives the command created by
tar#Extract looked like this:

    tar -I lz4pxf foo.tlz4 foo

This isn't right.  It should be something like this:

    tar -I lz4 -pxf foo.tlz4 foo

This was happening because tar.plugin is just substituting on the
first - in "tar -pxf".  This works fine if we just add a simple flag for
extraction (eg, z for .tgz), but for lz4 we need to add "-I lz4".

I don't believe that there is an obvious good way to fix this without
reworking the way the command is generated.  Probably we should collect
the command and flags separately and the flags should be stored in a
set. Then put everything together into a string just before issuing it
as an extraction command.  Unfortunately, this might break things for users
because they have access to tar_extractcmd.

This patch just makes the substitution a little bit more clever so that it
does the right thing when substituting on a string like "tar -pxf".

(2) .tar.lz4 extractions had the same issue, which my patch fixes in
the same way.

(3) .tar.lz4 extractions had another issue.  There was a space missing
in the command generated by tar#Extract.  This meant that commands
looked like this (notice the lack of space between the archive and output
file names):

    tar -I lz4pxf foo.tar.lz4foo

This patch just puts a space where it should be.

Finally, I should note that ChatGPT 5.4 initially identified this issue
in the code and generated the test cases.  I reviewed the test cases,
wrote the patch, and actually ran vim against the tests (both with and
without the patch).

closes: vim/vim#19925

78954f86c2

Co-authored-by: Aaron Burrow <burrows@fastmail.com>
2026-04-06 13:43:28 +00:00
zeertzjq
765c063f02 Merge pull request #38820 from zeertzjq/vim-9.2.0303
vim-patch:9.2.{0303,0304}
2026-04-06 16:52:06 +08:00
zeertzjq
f8695fc529 vim-patch:9.2.0304: tests: test for 9.2.0285 doesn't always fail without the fix
Problem:  When the terminal is very large, test for 9.2.0285 doesn't
          trigger an ASAN error without the fix.
Solution: Use a window with fixed height (zeertzjq)

closes: vim/vim#19924

b03970f41f
2026-04-06 16:28:06 +08:00
zeertzjq
c2d7f6b642 vim-patch:9.2.0303: tests: zip plugin tests don't check for warning message properly
Problem:  zip plugin tests may match messages from previous test cases
          when checking for warning message.
Solution: Clear messages at the start of these tests (zeertzjq).

closes: vim/vim#19926

a1f4259e68
2026-04-06 16:28:03 +08:00
Luuk van Baal
fa302037f9 fix(events): avoid recursive loop_uv_run() from vim.ui_attach() shell message
Problem:  vim.ui_attach() msg_show callback runs the risk of a recursive
          loop_uv_run() when trying to display a message from a shell
          command stream.
Solution: Schedule the message callback on the fast_events queue.
2026-04-06 10:07:23 +02:00
Sanzhar Kuandyk
8bb7533639 fix(channel): fix Ctrl-C handling regression in terminal
Problem: Normal Windows builtin-TUI startup spawns the embedded server as DETACHED_PROCESS, which breaks Ctrl-C delivery to :terminal jobs.
Solution: Restores the default behavior once the embedded server has a
console so terminal jobs inherit it.
2026-04-06 11:17:48 +05:00
nameearly
eb9be11da8 refactor(typval.c): fix wrong argument to macro (#38813) 2026-04-06 04:11:57 +00:00
zeertzjq
1fcd849d40 Merge pull request #38751 from zeertzjq/vim-9.2.0291
vim-patch:9.2.{0291,0293}
2026-04-06 12:01:12 +08:00
zeertzjq
870e50f0ff vim-patch:9.2.0293: :packadd may lead to heap-buffer-overflow
Problem:  :packadd may lead to heap-buffer-overflow when all entries in
          'runtimepath' have the same length (after 9.2.0291).
Solution: Check for comma after current entry properly (zeertzjq).

related: vim/vim#19854
closes:  vim/vim#19911

bc182ae56e
2026-04-06 11:47:44 +08:00
zeertzjq
4d7dfa081b vim-patch:9.2.0291: too many strlen() calls
Problem:  too many strlen() calls
Solution: refactor concat_fname() and remove calls to strlen()
          (John Marriott)

Function `concat_fnames()` can make up to 5 calls to `STRLEN()` (either
directly or indirectly via `STRCAT()`). In many cases the lengths of
arguments `fname1` and/or `fname2` are either known or can simply be
calculated.

This Commit refactors this function to accept the lengths of arguments
`fname1` and `fname2` as arguments. It also adds new argument `ret` to
return the resulting string as a `string_T`.

Additionally:
- function `add_pack_dir_to_rtp()` in `scriptfile.c`:
   Use a `string_T` to store local variables `new_rtp` and `afterdir`.
   Replace calls to `STRCAT()` with calls to `STRCPY()`.
   Change type of variable `keep` to `size_t` for consistency with
   other lengths.

- function `qf_get_fnum()` in `quickfix.c`:
  Use a `string_T` to store local variables `ptr` and `bufname`
- function `qf_push_dir()` in `quickfix.c`:
  Use a `string_T` to store local variable `dirname`.
  Replace call to `vim_strsave()` with `vim_strnsave()`.

- function `qf_guess_filepath()` in `quickfix.c`:
  Use a `string_T` to store local variable `fullname`.

- function `make_percent_swname()` in `memline.c`:
  Rename some variables to better reflect their use.
  Use a `string_T` to store local variables `d` and `fixed_name`.
  Slightly refactor to remove need to create an extra string.
- function `get_file_in_dir()` in `memline.c`:
  Use a `string_T` to store local variables `tail` and `retval`.
  Move some variables closer to where they are used.

- function `cs_resolve_file()` in `if_cscope.c`:
  Use a `string_T` to store local variable `csdir`.
  Remove one call to `STRLEN()`.

- function `add_pathsep()` in `filepath.c`:
  Refactor and remove 1 call to `STRLEN()`

- function `set_init_xdg_rtp()` in `option.c`:
  Use a `string_T` to store local variable `vimrc_xdg`.

closes: vim/vim#19854

cb51add7ae

Co-authored-by: John Marriott <basilisk@internode.on.net>
Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-06 11:47:44 +08:00
zeertzjq
4aa8969d29 vim-patch:9.2.0299: runtime(zip): may write using absolute paths (#38810)
Problem:  runtime(zip): may write using absolute paths
          (syndicate)
Solution: Detect this case and abort on Unix, warn in the documentation
          about possible issues

46f530e517

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-06 10:15:19 +08:00
Justin M. Keyes
42f6c55139 Merge #38796 from justinmk/doc2 2026-04-05 20:36:45 -04:00
Evgeni Chasnovski
157c7bccb0 fix(pack): avoid eager vim.version call #38705
Problem: Commands that rely on Git may need its version to perform more
  targeted actions (like decide which arguments are safe to use).
  For performance, computing this version is delayed up until it is
  needed (like to not compute on regular startup), but not done before
  every Git operation (as it is too much and can be done better).

  This requires storing the Git version in a variable which is currently
  initiated via `vim.version.parse()` call (most probably because it was
  easier to handle Lua types this way).

  However, the problem is that this results in sourcing `vim.version`
  and computing `vim.version.parse` on every startup even if no Git
  operation would be done.

Solution: Don't call `vim.version.parse()` during `require('vim.pack')`
  and ensure its more precise lazy computation.
2026-04-05 20:35:14 -04:00
Justin M. Keyes
6b796696c3 docs: statusline
fix https://github.com/neovim/neovim/issues/38670
2026-04-06 02:29:29 +02:00
Olivia Kinnear
13faa0ef84 feat(defaults): :Open without args opens current file #38776
Problem:
Running `:Open` on an open buffer does not run `vim.ui.open()` on that file, requiring the user to type `:Open %`. This is inconsistent with most other vim commands which accept files, which default to the current buffer's file.

Solution:
Default to the current file when `:Open` is used without arguments.
2026-04-05 19:46:45 -04:00
Elijah Koulaxis
bba48ee1b0 fix(windows): force console codepage to UTF-8 for shell/system() #38742
Problem:
On Windows, `:!echo тест` shows `????` because the console code page defaults to a legacy ANSI encoding (e.g. CP1252) instead of `UTF-8`

Solution:
Call `SetConsoleOutputCP(CP_UTF8)` and `SetConsoleCP(CP_UTF8)` in `do_os_system()` before spawning child processes, and restore the original values after. It covers both `:!` and `system()` since they both go through `do_os_system()`
2026-04-05 19:16:48 -04:00
Yi Ming
909fc0b992 fix(lsp): do not respond to codelens refresh if a request is already scheduled (#38801) 2026-04-05 13:54:27 -07:00
Tom Ampuero
6d420feaef fix(net): handle remote archive URLs via tar/zip browse #38744
Problem:
Opening .tar.gz or .zip URLs shows raw binary instead of using the archive plugins.

Solution:
Similar to the original netrw implementation, the autocmd should detect
archive URLs, download them to a temp file and the open them with
tar/zip handlers already bundled as vim plugins.
2026-04-05 15:22:26 -04:00
Jibril
cfbac23235 fix(coverity): coverity/530031, coverity/530027 resource leaks #37916
Fixed resource leak caused by overwriting lp->sl_midword by freeing
lp->sl_midword first.
2026-04-05 15:08:30 -04:00
Yochem van Rosmalen
398ee83f4f fix(vim.net): check if vim.system's stdout is nil #38713
Problem:
Apparently vim.SystemCompleted.stdout can also be nil, even without a
custom stdout handler. (Although the docs can be interpreted otherwise).

Solution:
Explicitly check for nil and set the result body to an empty string if
stdout was nil.
2026-04-05 13:11:59 -04:00
Evgeni Chasnovski
3cba8df041 fix(pack): use uv.available_parallelism() to compute number of threads #38717
Problem: Computing number of threads for parallel asynchronous
  computation using `uv.cpu_info()` can be slow. This is especially
  noticeable since it is pre-computed on every `require('vim.pack')` and
  not only when parallelism is needed.

Solution: Use `uv.available_parallelism()` to compute number of threads
  in a helper function.
2026-04-05 13:06:00 -04:00
Justin M. Keyes
57457f227d docs: bump minimum required Win 10 to version 2004
see https://github.com/neovim/neovim/issues/32367#issuecomment-4188641644
2026-04-05 18:22:59 +02:00
zeertzjq
9705a1c13b fix(help): show error when using :help! with nothing at cursor #38775
It's possible to still show the old Easter egg, but then the user won't
know about the new feature, so showing E349 is better.
2026-04-05 10:59:22 -04:00
github-actions[bot]
38c32aa029 docs: update version.c #38752
vim-patch:9.2.0286: still some unnecessary (int) casts in alloc()
vim-patch:9.2.0288: libvterm: signed integer overflow parsing long CSI args
vim-patch:bd8b6c6b0 CI: Bump codecov/codecov-action
vim-patch:9.2.0294: if_lua: lua interface does not work with lua 5.5
vim-patch:9.2.0297: libvterm: can improve CSI overflow code

vim-patch:8.2.0356: MS-Windows: feedkeys() with VIMDLL cannot handle CSI
vim-patch:8.2.0647: MS-Windows: repeat count for events was not used
2026-04-05 10:51:18 -04:00
luukvbaal
2663f51890 fix(ui2): update spill indicator when appending to expanded cmdline #38715
Problem:  When messages are appended to an already expanded cmdline,
          the spilled lines indicator is not updated.
Solution: Remove early return for updating virtual text while cmdline is
          expanded, guard updating "msg" virt_text at callsite instead.
2026-04-05 09:48:38 -04:00
dundargoc
bebf949f1f build(cmake): allow ignoring deps sha
Followup to 39335d6a7d.
2026-04-05 11:29:55 +02:00
Christian Clason
39335d6a7d build(cmake): allow ignoring deps sha
Problem: Specifying an URL (e.g., Github URL for a PR commit) on the
command line does not work since it will check it against the pinned
checksum.

Solution: Allow overriding `DEPS_IGNORE_SHA` from the command line as
well.
2026-04-05 00:08:56 +02:00
zeertzjq
9927d9259d fix(:restart): inherit stderr fd on Unix (#38755)
This in turn gives TTY access to channel_from_stdio() in the new server,
if the old server has access to a TTY.
2026-04-04 21:57:27 +08:00
zeertzjq
e20c4ea966 fix(channel): crash on exit after closing v:stderr channel (#38754)
Problem:  Crash on exit after closing v:stderr channel when piping
          to stdin.
Solution: Reopen stderr as /dev/null or NUL instead of closing it.
          This also avoids writing to an related file if one is opened
          after closing v:stderr.
2026-04-04 20:54:27 +08:00
zeertzjq
c62f8538a6 vim-patch:5943c57: runtime(zathurarc): Update page-padding, wrap the zathurarcOption keywords (#38759)
page-padding was split in page-v-padding and page-h-padding

closes: vim/vim#19899

5943c57173

Co-authored-by: Carlo Klapproth <6682561+elcarlosIII@users.noreply.github.com>
2026-04-04 20:50:16 +08:00