Commit Graph

35564 Commits

Author SHA1 Message Date
glepnir
3e8a4e1092 feat(lsp): show color preview in completion items #32138
Problem: Color completion items display as plain text without visual preview

Solution: Parse RGB/hex colors from documentation and render with colored symbol ■
2026-02-28 10:02:52 -05:00
Nicknamess96
c1e60f36f3 fix(difftool): don't reset quickfix list when closing quickfix window #38088
Closing the quickfix window previously triggered a WinClosed autocmd
that deleted all difftool autocmds and pushed an empty quickfix list,
making the difftool non-functional. Users who close the quickfix window
to gain screen real estate for viewing diffs had no way to continue
navigating entries.

Remove the qf_win tracking and its associated WinClosed autocmd so that
closing the quickfix window no longer tears down the difftool state.
Closing either diff window still performs full cleanup as before.

The BufWinEnter handler no longer passes with_qf to diff_files, so
navigating entries while the quickfix window is closed reuses the
existing diff layout without forcing a layout rebuild.

Fixes #37388
2026-02-28 09:59:53 -05:00
luukvbaal
32e0d05d53 feat(ui2): configure targets per message kind #38091
Problem:  Unable to configure message targets based on message kind.
Solution: Add cfg.msg.targets mapping message kinds to "cmd/msg/pager".
          Check the configured target when writing the message.
          cfg.msg = { target = 'cmd', targets = { progress = 'msg', list_cmd = 'pager' } }
          will for example use the 'msg' target for progress messages,
          immediately open the pager for 'list_cmd' and use the cmdline
          for all other message kinds.
2026-02-28 08:31:02 -05:00
Sanzhar Kuandyk
b40ca5a01c fix(channel): support :detach, :restart on Windows #37977
fix: allocate hidden console for detached server

Starting the server with UV_PROCESS_DETACHED results in DETACHED_PROCESS, leaving the child without a console. Without a console:

CONIN$ / CONOUT$ cannot resolve, causing channel_from_stdio to fail.

ConPTY cannot attach, breaking :terminal.

This patch allocates a hidden console via AllocConsole() when the server has none, restoring working stdio and enabling ConPTY.

Also updates os_set_cloexec to clear HANDLE_FLAG_INHERIT on the RPC pipe
handles, matching the Unix F_DUPFD_CLOEXEC behavior.
2026-02-28 08:21:13 -05:00
glepnir
5943a81fe7 fix(float): style=minimal leaks into normal windows #25185
Problem: closing a minimal float saves its style-imposed options into
buffer's wininfo, which get picked up by normal windows on :bnext.

Solution: don't save window options to wininfo for style=minimal windows.
2026-02-28 13:20:56 +00:00
Rawan Khalid
9763834170 fix(cmake): use host nlua0 binary when cross-compiling #38089
Problem:
When cross-compiling, `$<TARGET_FILE:nlua0>` resolves to the target
binary, which cannot run on the host machine during the build process.

Solution:
Allow passing a host native nlua0 binary via
`-DNLUA0_HOST_PRG=/path/to/nlua0` when cross-compiling, so code
generation can run correctly on the host.
2026-02-28 07:17:46 -05:00
Yochem van Rosmalen
74d1af165a revert :gen_help_html.lua commit 4a4de73 #38100
revert commit 4a4de73043
2026-02-28 06:34:01 -05:00
zeertzjq
7e8bdd348c vim-patch:9.2.0077: [security]: Crash when recovering a corrupted swap file (#38104)
Problem:  memline: a crafted swap files with bogus pe_page_count/pe_bnum
          values could cause a multi-GB allocation via mf_get(), and
          invalid pe_old_lnum/pe_line_count values could cause a SEGV
          when passed to readfile() (ehdgks0627, un3xploitable)
Solution: Add bounds checks on pe_page_count and pe_bnum against
          mf_blocknr_max before descending into the block tree, and
          validate pe_old_lnum >= 1 and pe_line_count > 0 before calling
          readfile().

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-r2gw-2x48-jj5p

65c1a143c3

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-02-28 04:33:47 +00:00
zeertzjq
a416494e64 vim-patch:9.2.0078: [security]: stack-buffer-overflow in build_stl_str_hl() (#38102)
Problem:  A stack-buffer-overflow occurs when rendering a statusline
          with a multi-byte fill character on a very wide terminal.
          The size check in build_stl_str_hl() uses the cell width
          rather than the byte length, allowing the subsequent fill
          loop to write beyond the 4096-byte MAXPATHL buffer
          (ehdgks0627, un3xploitable).
Solution: Update the size check to account for the byte length of
          the fill character (using MB_CHAR2LEN).

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-gmqx-prf2-8mwf

4e5b9e31cb

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-02-28 09:22:41 +08:00
zeertzjq
7e65c44cfb Merge pull request #38101 from zeertzjq/vim-9.2.0074
vim-patch:9.2.{0074,0075}
2026-02-28 09:09:41 +08:00
zeertzjq
e85fc92a6b vim-patch:9.2.0075: [security]: Buffer underflow with emacs tag file
Problem:  When parsing a malformed Emacs-style tags file, a 1-byte
          heap-buffer-underflow read occurs if the 0x7f delimiter
          appears at the very beginning of a line. This happens
          because the code attempts to scan backward for a tag
          name from the delimiter without checking if space exists.
          (ehdgks0627, un3xploitable)
Solution: Add a check to ensure the delimiter (p_7f) is not at the
          start of the buffer (lbuf) before attempting to isolate
          the tag name.

GitHub Advisory:
https://github.com/vim/vim/security/advisories/GHSA-xcc8-r6c5-hvwv

9b7dfa2948

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-02-28 08:12:25 +08:00
zeertzjq
95ddabdb2b vim-patch:9.2.0074: [security]: Crash with overlong emacs tag file
Problem:  Crash with overlong emacs tag file, because of an OOB buffer
          read (ehdgks0627, un3xploitable)
Solution: Check for end of buffer and return early.

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-h4mf-vg97-hj8j

f6a7f469a9

Cherry-pick a change from patch 9.0.0767.
Add missing change from patch 9.2.0070.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-02-28 08:11:01 +08:00
zeertzjq
c4fdd3b072 vim-patch:9148644: runtime(env): add ftplugin for env filetype (#38098)
Patch 9.2.0033 (vim/vim#19260) introduced a dedicated `env` filetype for
.env files, which were previously detected as `sh`. This left env
files without `commentstring`, `comments`, or `formatoptions` since
no ftplugin was added alongside the new filetype.

Add runtime/ftplugin/env.vim to set these options, matching the
behavior that .env files had when they used the `sh` filetype.

closes: vim/vim#19522

9148644c1e

Co-authored-by: snelling-a <72226000+snelling-a@users.noreply.github.com>
2026-02-28 08:00:17 +08:00
zeertzjq
3e128cd798 Merge pull request #38099 from zeertzjq/vim-9.1.0535
vim-patch:9.1.{0535,0539},9.2.0070
2026-02-28 07:46:36 +08:00
zeertzjq
cd4c7850d0 vim-patch:9.2.0070: tests: various tests leave swapfiles around
Problem:  tests: various tests leave swapfiles around
Solution: close open buffers using :bw! instead of :close!

2fa34b6422

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-02-28 07:06:44 +08:00
zeertzjq
6ce964aed6 vim-patch:9.1.0539: Not enough tests for what v9.1.0535 fixed
Problem:  Not enough tests for what v9.1.0535 fixed
Solution: Add another test for ex-mode

This comes from: https://groups.google.com/g/vim_dev/c/F5-tDqoafz8/m/GqKF-uQsLD0J

related: vim/vim#15120

248efab9b5

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-02-28 07:04:49 +08:00
zeertzjq
453dfbf7d6 vim-patch:9.1.0535: newline escape wrong in ex mode
Problem:  newline escape wrong in ex mode (Konrad Schwarz)
Solution: partly revert patch 7.3.014, remove backslash in front of a
          newline when not in prompt mode in ex line mode
          (Mohamed Akram)

This fixes newline escaping to allow passing multiple commands to
":global", multiple lines to shell commands, and ending lines in append
mode with backslashes. This should fix a POSIX/(traditional) VI
incompatiblity.

This reverts a previous incorrect attempt at patch v7.3.014 to fix
append mode which removed half of trailing backslashes which lead to,
eg. the following two commands being parsed as having a different number
of backslashes:

```
!echo foo\\\
```

```
!echo foo\\ \
```

fixes: vim/vim#6135
fixes: vim/vim#7244
closes: vim/vim#15120

f3daa4525b

Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
2026-02-28 07:04:08 +08:00
Yochem van Rosmalen
4a4de73043 fix(help): better align local-additions #38097
Problem:
Descriptions of plugins often contain taglinks which are generally
concealed. This misaligns them by 2 characters with descriptions that
don't have a taglink in them.

Solution:
Don't count "bar" characters (`|`) for the description width.

Example:

Actual buffer content:
```
myplugin.txt                  |lsp| is cool
myplugin.txt        this is a nice plugin
```

Rendered as:
```
myplugin.txt                  lsp is cool
myplugin.txt        this is a nice plugin
```
2026-02-27 17:50:51 -05:00
Yochem van Rosmalen
dc5d313d66 fix(vim.fs): joinpath() should ignore empty items #38077
Problem:
vim.fs.joinpath treats empty string as a path segment
(it adds a path separator for each empty item):

    print(vim.fs.joinpath('', 'after/lsp', '')) -- '/after/lsp/'
    print(vim.fs.joinpath('', '')) -- '/'

Especially problematic if the empty segment is the first segment, as
that converts the path to an absolute path.

Solution:
Ignore empty (length of 0) path segments.

Benchmark:

    local function test(func)
      local t = vim.uv.hrtime()
      for _ = 1, 100000, 1 do
        func('', 'this/is', 'a/very/long/path', '', 'it', 'really', 'is')
      end
      print(math.floor((vim.uv.hrtime() - t) / 1e6), 'ms')
    end

- with Iter():filter() --> 370 ms
- building new segments table --> 208 ms
- with vim.tbl_filter --> 232 ms
- Instead of gsub split on `/` in all parts --> 1870 ms
2026-02-27 17:45:07 -05:00
dependabot[bot]
4747975754 ci: bump actions/download-artifact from 7 to 8
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7 to 8.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-27 14:04:49 +01:00
bfredl
044300b72c Merge pull request #38074 from bfredl/mapfix
fix(map): use names like Map_key_value not Map_keyvalue
2026-02-27 13:58:04 +01:00
dependabot[bot]
64fabe64e5 ci: bump actions/upload-artifact from 6 to 7
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-27 13:51:05 +01:00
Riccardo Mazzarini
2368a9edbd feat(terminal): support SGR dim, overline attributes #37997
Problem:
libvterm doesn't support parsing the dim and overline attributes, so when a program running in the embedded terminal emits one of these escape codes, we ignore it and don't surface it to the outer terminal.

Solution: tweak libvterm to add support for both attributes.
2026-02-27 11:46:22 +00:00
bfredl
84d3bbef23 fix(map): use names like Map_key_value not Map_keyvalue
This makes little difference in practice except for extremely unlikely
ambiguities. But it looks nicer in compiler errors and stacktraces where
you see the fully expanded names
2026-02-27 11:47:07 +01:00
Kyle
5cbb9d613b fix(startup): wait for bg detection before user config #37075
Problem:
Automatic background detection sets the background option too late,
which loads colorschemes twice and causes problems when the user's
terminal background doesn't match the default (#32109, #36211, #36416).

Solution:
Use a DA1 query to determine whether the TTY supports OSC 11. Wait for
background detection and setting to complete before processing user
config.

Note: To preserve the existing behavior as much as possible, this triggers
OptionSet manually on VimEnter (since it won't trigger automatically if
we set bg during startup). However, I'm unsure if this behavior is
truly desired given that the documentation says OptionSet is triggered
"After setting an option (except during |startup|)."

Also fixes flickering issue #28667. To check for flickering:

    nvim --clean --cmd "set termguicolors" --cmd "echo \"foo\"" --cmd "sleep 10"

On master, this gives me a black screen for 10 seconds, but on this
branch, the background is dark or light depending on the terminal
background (since the option is now set during startup rather than after
VimEnter).
2026-02-27 04:52:52 -05:00
glepnir
f45c550f4e fix(restart): drop "-s <scriptfile>" from v:argv on :restart #38058
Problem: When nvim is started with "-s -" (read from stdin), ":restart"
drops the "-" argument but keeps "-s", leaving an orphaned "-s" in the
restarted server's argv, causing a crash.

Solution: Drop "-s" and its scriptfile argument when copying v:argv for
the restarted server. Like "-- [files…]", the scriptfile is a one-shot
startup input that should not be replayed on restart
2026-02-27 04:30:45 -05:00
Christian Clason
acf8103199 build(deps): bump luajit to a553b3de2 2026-02-27 09:49:58 +01:00
zeertzjq
18c5f06c9f vim-patch:partial:9.2.0068: Inefficient use of list_append_string() (#38083)
Problem:  Inefficient use of list_append_string()
Solution: Pass string length to list_append_string() where it is known
          (John Marriott).

closes: vim/vim#19491

455d62e38a

N/A patches:
vim-patch:9.2.0063: memory leak in type_name_list_or_dict()
vim-patch:9.2.0065: memory leak in invoke_sync_listeners()
vim-patch:9.2.0066: memory leak in build_drop_cmd()
vim-patch:9.2.0067: memory leak in dict_extend_func()

Co-authored-by: John Marriott <basilisk@internode.on.net>
2026-02-27 07:32:08 +08:00
Christian Clason
6435c61bd6 build(deps): bump tree-sitter-markdown to v0.5.3 2026-02-26 19:26:35 +01:00
Christian Clason
d94c29114e build(deps): bump tree-sitter-lua to v0.5.0 2026-02-26 19:26:35 +01:00
Christian Clason
37ce3d6261 build(deps): bump tree-sitter-vim to v0.8.1 2026-02-26 19:26:35 +01:00
Riccardo Mazzarini
ea5007b37f fix(lps): separate namespaces for pull/push diagnostics #37938
Problem:
Regression from b99cdd0:
Pull diagnostics (from `textDocument/diagnostic`) and push diagnostics
(from `textDocument/publishDiagnostics`) use the same namespace, which
is a problem when using language servers that publish two different sets
of diagnostics on push vs pull, like rust-analyzer (see
https://github.com/rust-lang/rust-analyzer/issues/18709#issuecomment-2551394047).

Solution:
Rename `is_pull` to `pull_id` which accepts a pull namespace instead of
just a boolean.
2026-02-26 12:05:30 -05:00
zeertzjq
7852993f49 vim-patch:9.2.0061: Not possible to know when a session will be loaded (#38071)
Problem:  Not possible to know when a session will be loaded.
Solution: Add the SessionLoadPre autocommand (Colin Kennedy).

fixes:  vim/vim#19084
closes: vim/vim#19306

1c0d468d72

Co-authored-by: Colin Kennedy <colinvfx@gmail.com>
2026-02-26 21:30:44 +08:00
zeertzjq
34b3bd1ac5 test(treesitter/fold_spec): fix flaky test (#38075) 2026-02-26 21:28:52 +08:00
luukvbaal
e63346dfe9 fix(messages): reset redirection message column at message start #38068
Problem:  Leading message newlines (not emitted with ext_messages since
          4260f73) were responsible for resetting the redirection message
          column (while the newline itself is later pruned...).
Solution: Ensure the redirection column is reset at the start of a message.
          (Instead of re-adjusting all the newline callsites which can
          themselves hopefully be pruned if ext_messages is enabled by
          default.)
2026-02-26 07:45:33 -05:00
bfredl
8f1c161d9d Merge pull request #38040 from bfredl/seenfix
fix(marktree): fix edge case bug regarding changing intersections
2026-02-26 12:49:29 +01:00
bfredl
37c0efb21c fix(marktree): fix edge case bug regarding changing intersections
fix #37867

This bug happens when only one end is moved between different nodes,
but the other end is also moved but within the same node.
When this happens we need the correct previous position even for the
internal move. This code shall be refactored to make the intent clearer,
(and avoid some unnecessary processing) but this is a fix for the observable
bug.

Thanks to KevinGoodsell for providing a deterministic
reproduce using fuzzing techniques.
2026-02-26 10:30:41 +01:00
bfredl
3a4a7a7efb Merge pull request #37722 from bfredl/fastpackadd
perf(runtime): hardware accelerated "packadd opt_package"
2026-02-26 10:29:49 +01:00
github-actions[bot]
be8969f4cc docs: update version.c (#38053)
vim-patch:9.2.0001: tests: Test_popup_setbuf() fails
vim-patch:9.2.0047: Vim9: Comment parsing error with lambda
vim-patch:9.2.0052: Wayland: hiding lower half of command line in tiny vim

Co-authored-by: marvim <marvim@users.noreply.github.com>
2026-02-26 12:02:20 +08:00
anondeveg
6ba32713ad feat(secure): allow 'path' parameter for trust action 'allow' (#38001) 2026-02-25 20:55:05 -06:00
zeertzjq
e86ccdbeae test: remove remaining use of feed_command() in terminal/ (#38069)
Also deduplicate screen lines in some other tests.
2026-02-26 10:06:34 +08:00
zeertzjq
1fe1b2525f vim-patch:9.2.0054: eval_addblob() is inefficient (#38067)
Problem:  eval_addblob() is inefficient
Solution: Replace per-byte ga_append() loop with a single ga_grow() and
          mch_memmove() for each source blob.  This eliminates N grow
          checks and function call overhead for blob concatenation
          (Yasuhiro Matsumoto).

closes: vim/vim#19494

c389ae8c44

Omit the pointless int -> long changes in other functions.

Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
2026-02-26 08:15:57 +08:00
zeertzjq
9288357d59 vim-patch:9.2.0055: memory leak in ExpandFromContext() (#38066)
Problem:  memory leak in ExpandFromContext()
Solution: Free the variable (Huihui Huang).

fixes:  vim/vim#19500
closes: vim/vim#19505

9c3279ddc3

N/A patches:
vim-patch:9.2.0056: memory leak in ex_substitute
vim-patch:9.2.0057: memory leak in exe_newdict()
vim-patch:9.2.0058: Compile error in did_set_previewpopup()
vim-patch:9.2.0059: memory leak in fill_assert_error

Co-authored-by: Huihui Huang <625173@qq.com>
2026-02-26 00:04:34 +00:00
Mathias Fußenegger
583308f599 fix(diagnostic): handle stale diagnostic extmark ids #38060
Problem:
If a server is slow with catching up, there can be stale diagnostics
for deleted lines. Then if a user uses `jump` it can error like:

    E5108: Lua: ...runtime/lua/vim/diagnostic.lua:670: attempt to index a nil value
    stack traceback:
            ...runtime/lua/vim/diagnostic.lua:670: in function 'get_logical_pos'
            ...runtime/lua/vim/diagnostic.lua:687: in function 'diagnostic_lines'
            ...runtime/lua/vim/diagnostic.lua:1122: in function 'next_diagnostic'
            ...runtime/lua/vim/diagnostic.lua:1665: in function 'jump'

Solution:
Fallback to diagnostic location. That's better than the failure.
2026-02-25 13:26:56 -05:00
luukvbaal
4ef217e272 fix(ui2): leftover empty lines in msg window #38059
Problem:  Timer removing a message from the msg buffer does not remove
          empty lines if window is closed (col([ui.wins.msg]) fails).
Solution: Use nvim_buf_get_text() to check if line is empty.
2026-02-25 13:21:30 -05:00
Justin M. Keyes
c0f8b3fb66 refactor(test): simplify v:argf tests #38055 2026-02-25 13:06:53 -05:00
zeertzjq
1983c70d10 test(lsp): flaky lsp/semantic_tokens_spec #38063
The wait added in #37853 doesn't seem to do anything as request is sent
immediately on InsertLeave, and the number 4 also seems wrong. Instead,
the actual cause for the flakiness that the feed() (and hence the buffer
change) may arrive before the scheduled initialization of capabilities,
causing there be only only one textDocument/semanticTokens/full request
instead of two.
2026-02-25 13:04:31 -05:00
Christian Clason
44429b4d96 build(deps): bump wasmtime to v36.0.6 2026-02-25 18:32:39 +01:00
Christian Clason
88ff4f1ac3 build(deps): bump tree-sitter to v0.26.6 2026-02-25 18:32:39 +01:00
Christian Clason
39769b4ac2 build(deps): bump luajit to fc3d17eb4 2026-02-25 11:04:51 +01:00