Commit Graph

35749 Commits

Author SHA1 Message Date
Yinzuo Jiang
34fea4fc64 vim-patch:fce324f557: runtime(termdebug): close all buffers in the same way
For ASM and Variables buffer, check were done to make sure they existed
before attempting to close them, but not for debugged program or gdb
communication. The debugged program window is a user-facing one and
user might close it manually, so it's better to check if it exists.

fce324f557

Co-authored-by: Damien Riegel <damien@riegel.io>
AI-assisted: Codex
2026-03-16 19:05:15 +08:00
Sean Dewar
3cd07709ba fix(terminal): don't always leave if enter autocmds delete buffer #38324
Problem: #38316 is a bit aggressive; we need not always leave Terminal mode if
autocmds put us in a different terminal.

Solution: don't skip entering; let terminal_check_focus handle whether we should
immediately leave.
2026-03-16 09:56:36 +00:00
Christian Clason
5a0a26a725 build(deps): bump luv to 1.52.1-0 2026-03-16 10:29:58 +01:00
Justin M. Keyes
16f7440cc7 feat(help): super K (":help!") guesses tag at cursor #36205
Problem:
`K` in help files may fail in some noisy text. Example:

      (`fun(config: vim.lsp.ClientConfig): boolean`)
                            ^cursor

Solution:
- `:help!` (bang, no args) activates DWIM behavior: tries `<cWORD>`,
  then trims punctuation until a valid tag is found.
- Set `keywordprg=:help!` by default.
- Does not affect `CTRL-]`, that is still fully "tags" based.
2026-03-15 19:02:49 -04:00
Ayaan
747da13f44 fix(terminal): check buf before deleting extmark #38314
Problem: buffer could be null when trying to delete "[Process exited]"
extmark

Solution: delete extmark only if buffer exists
2026-03-15 17:41:05 -04:00
Sean Dewar
1c57e4cb4f fix(terminal): heap UAF from autocmds when entering #38316
Problem: heap-use-after-free possible when entering Terminal mode if
autocommands close the terminal.

Solution: set the refcount. Skip to the end if we must close the terminal.
2026-03-15 17:38:25 -04:00
phanium
0ca9849387 fix(statusline): missing info/hint diagnostics #38307
Problem: default stl treat vim.diagnostics.count() return as array

Solution: next() tell if a dict is empty
2026-03-15 10:35:08 -04:00
zeertzjq
9084483715 test(ui/mode_spec): fix retry not working (#38300) 2026-03-15 08:00:07 +08:00
zeertzjq
e3bb60d475 Merge pull request #38299 from zeertzjq/vim-9.2.0159
vim-patch:9.2.{0159,0162,0165}
2026-03-15 07:09:29 +08:00
zeertzjq
0082cd3134 vim-patch:9.2.0165: tests: perleval fails in the sandbox
Problem:  tests: perleval fails in the sandbox
          (after v9.2.0156)
Solution: Update tests and assert that it fails

related: vim/vim#19676

3f89324b3a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-03-15 06:31:26 +08:00
zeertzjq
1aaa8e8e3a vim-patch:9.2.0162: tests: unnecessary CheckRunVimInTerminal in test_quickfix
Problem:  tests: unnecessary CheckRunVimInTerminal in test_quickfix.vim
          (after v9.2.0159)
Solution: Remove it (zeertzjq).

closes: vim/vim#19671

81d5329ace
2026-03-15 06:28:47 +08:00
zeertzjq
80684a418b vim-patch:9.2.0159: Crash when reading quickfix line
Problem:  Crash when reading quickfix line (Kaiyu Xie)
Solution: Make sure line is terminated by NUL

closes: vim/vim#19667

Supported by AI

8d13b8244a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-03-15 06:26:53 +08:00
Justin M. Keyes
8c2b6d6062 Merge #35816 nvim_win_set_config can move floatwin to another tabpage 2026-03-14 17:44:06 -04:00
Sean Dewar
3115e3d0d1 fix(api): improve external window validation
Problem: "win" is allowed in external window configs in some cases. External
window converted to normal float can't move tabpages in one nvim_win_set_config
call. External window can't be turned into a normal split.

Solution: disallow setting "win" for external windows. Allow external window to
move tabpages, which turns it non-external. Allow external window to be turned
into a (non-external) split.

parse_win_config has more validation issues from not considering the window's
existing config enough (not from this PR). For example, zindex can be set for an
existing split if "split"/"vertical" isn't given, despite intending for that to
be an error. Plus the logic is confusing.

It could do with a refactor at some point...
2026-03-14 20:48:32 +00:00
Sean Dewar
853eea859f fix(api): disallow moving window between tabpages in more cases
Problem: more cases where it may not be safe to move a window between tabpages.

Solution: check them.

Rather speculative... I haven't spend much time looking, but I didn't find
existing code that sets these locks to skip checking win_valid. (what I did find
called it anyway, like in win_close) Still, I think it's a good precaution for
what future code might do.

If the fact that nvim_win_set_config *actually* moves windows between tabpages
causes unforeseen issues, "faking" it like ":wincmd T" may be an alternative:
split a new window, close the old one, but instead also block autocmds, copy the
old window's config, and give it its handle?
2026-03-14 20:48:32 +00:00
Sean Dewar
094b297a3b feat(api): nvim_win_set_config can move split to other tp as floatwin
Problem: not possible for nvim_win_set_config to convert a split to a floatwin,
then move it to another tabpage in one call.

Solution: allow it.
2026-03-14 20:48:32 +00:00
Sean Dewar
3325536150 fix(winfloat): last_status when changing split to floatwin
Problem: converting a split to a floatwin may not remove the last statusline
when needed. (e.g: 'ls' is 1)

Solution: call last_status/win_comp_pos in win_new_float, after win_remove.

Also fix float_pos formatting for screen snapshots so it doesn't give a nil
error for external windows.

Not an issue from this PR.
2026-03-14 20:48:32 +00:00
Sean Dewar
7be4ae796f fix(api): relax config validation for "win"
Problem: only possible to move floats between tabpages if relative=win, which
has the restrictive effect of also anchoring it to the target window.

Solution: allow "win" without "relative" or "split"/"vertical". Only assume
missing "win" is 0 if relative=win is given to maintain that behaviour. (or when
configuring a new window)

Also add an error when attempting to change a split into a float that's in
another tabpage, as this isn't actually supported yet. (until the next commit)

Maybe this could do with some bikeshedding. Unclear if "win" should require
"relative" to be given, like with "row"/"col"; this can be annoying though as
specifying "relative" requires other fields to be given too.
2026-03-14 20:48:31 +00:00
Sean Dewar
dc00f628a2 refactor(window): lastwin_nofloating takes tp 2026-03-14 19:27:20 +00:00
Sean Dewar
ef084b5c22 fix(api): don't config split as floatwin relative to itself
Problem: possible to configure a split as a floatwin with relative=win that is
relative to itself.

Solution: fix the check.

Not caused by this PR; just something I noticed when about to fix the validation
logic.
2026-03-14 19:27:20 +00:00
Sean Dewar
c924c2a7b3 fix(api): win_config_float_tp grid removal, redraw
Problem: when nvim_win_set_config moves a floatwin between tabpages, its grid
may remain if temporarily inside another tabpage. Also, things like tablines
aren't redrawn.

Solution: always remove its grid. Set must_redraw so things are redrawn even if
w_redr_type was already set for the old tabpage.

I don't think it's necessary to do anything extra here when removing the grid:

- win_ui_flush calls ui_call_win_hide anyway, and calling it manually ends up
  sending two win_hide events.
- ui_comp_remove_grid safely does nothing if the grid doesn't exist.
- w_pos_changed is set by win_config_float later, if that's needed. I think the
  pending_comp_index_update set by ui_comp_remove_grid is enough anyway, at
  least for making sure win_ui_flush sends win_hide.

Added test fails with the prior approach of checking `parent_tp != curtab`, but
also `win_tp == curtab`. (which is a better, but still flawed alternative)

The added redrawing here also supersedes setting w_hl_needs_update, and also
redraws stuff like the tabline to pass the new test.
2026-03-14 19:27:20 +00:00
Sean Dewar
e5240b35c3 refactor(api): cleanup, more comments, more tests, news
- Factor out logic to keep nvim_win_set_config clean.
- Clean up a few things, remove redundant logic, reflow some lines.
- Add some more comments where appropriate.
- Don't consider negative "win", as that's only relevant for splits.
- Add more test coverage.
- Add news.txt entry.
2026-03-14 19:27:19 +00:00
glepnir
e2a0748cb2 feat(api): nvim_win_set_config can move floatwin to another tabpage
Problem: nvim_win_set_config can't move floating windows to different tab pages.

Solution: allow it.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2026-03-14 18:45:29 +00:00
Christian Clason
0a9d6dc9aa build(deps): bump tree-sitter to v0.26.7 2026-03-14 18:04:20 +01:00
luukvbaal
83037cf218 fix(messages): allocate message history kind string #38292
Problem:  nvim_echo()->kind memory may be used after it is freed with :messages.
Solution: Copy and free message kind string in message history.
2026-03-14 08:07:55 -04:00
altermo
929be7ee00 refactor(treesitter): move range related functions 2026-03-14 12:25:14 +01:00
altermo
39fa5e8ba9 docs(treesitter): fix typo 2026-03-14 12:25:14 +01:00
glepnir
5653b25e9b fix(lsp): handle non-string documentation in completion items #38291
Problem: `get_doc` throws error with "attempt to get length of a userdata
value" when `item.documentation` is truthy but not a string (e.g. vim.NIL
from a JSON null).

Solution: Check `type(item.documentation)` before taking its length.
2026-03-14 05:20:34 -04:00
Sean Dewar
b4e3461e3f fix(window): don't leak fold memory with style=minimal #38287
Problem: discarding saved option values in the WinInfo of closed style=minimal
windows leaks memory.

Solution: also free the nested folds.
2026-03-14 05:18:21 -04:00
github-actions[bot]
ab05b58b88 docs: update version.c #38222
vim-patch:9.2.0128: Wayland: using _Boolean instead of bool type
vim-patch:9.2.0133: memory leak in netbeans_file_activated()
vim-patch:9.2.0136: memory leak in add_interface_from_super_class()
vim-patch:1429277f0 gitattributes: mark dump files as linguist-generated
vim-patch:9.2.0154: if_lua: runtime error with lua 5.5
vim-patch:9.2.0157: Vim9: concatenation can be improved
vim-patch:9.2.0141: :perl ex commands allowed in restricted mode
vim-patch:9.2.0142: Coverity: Dead code warning
vim-patch:9.2.0146: dictionary lookups can be improved
vim-patch:9.2.0148: Compile error when FEAT_DIFF is not defined
vim-patch:9.2.0156: perleval() and rubyeval() ignore security settings
2026-03-14 05:09:58 -04:00
zeertzjq
f58d24040a vim-patch:9.2.0155: filetype: ObjectScript are not recognized (#38288)
Problem:  filetype: ObjectScript are not recognized
Solution: Add ObjectScript filetype detection for *.cls files
          (Hannah Kimura)).

Reference:
https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GCOS_intro

closes: vim/vim#19668

b11c8efbe6

Co-authored-by: Hannah <hannah.kimura@intersystems.com>
2026-03-14 01:42:10 +00:00
zeertzjq
d3bca3b7fa vim-patch:9.2.0152: concatenating strings is slow (#38286)
Problem:  concatenating strings is slow
Solution: Use grow_string_tv() to grow the existing string buffer in
          place when possible (Yasuhiro Matsumoto).

closes: vim/vim#19642

16d421a4d9

Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
2026-03-14 08:14:34 +08:00
nikolightsaber
fd1e019e90 refactor(treesitter)!: get_parser return nil on error #37276 2026-03-13 15:57:36 -04:00
Justin M. Keyes
8499af1119 Merge #38268 docs: misc 2026-03-13 15:37:12 -04:00
Justin M. Keyes
017d8aa298 refactor: rename _ensure_integer => _assert_integer 2026-03-13 20:32:01 +01:00
Justin M. Keyes
682c77805c docs: misc 2026-03-13 20:32:01 +01:00
luukvbaal
911337eb3c fix(normal): crash using :norm from vim.ui_attach shell message event #38283
Problem:  'showcmd' buffer is being populated for :norm commands, which
          can result in a recursive uv_run() when called from a msg_show
          vim.ui_attach callback for a shell message.

Solution: The 'showcmd' buffer is never displayed while executing a
          :normal command so prevent unnecessary work, avoiding the crash.
2026-03-13 09:36:44 -04:00
Justin M. Keyes
f51c54ace6 build: noisy readability-implicit-bool-conversion warning #38282
Problem:
clangd shows `Implicit conversion 'int' -> 'bool'` warnings.
This is mostly noise in this codebase.

Solution:
- Disable the warning.
- Get latest clang-tidy in CI.
2026-03-13 09:02:22 -04:00
Lewis Russell
6766e6104f ci: label disclosed AI-assisted PRs
Add a simple AGENTS.md rule for the AI-Assisted trailer in commit
messages and a workflow that adds the AI assisted label when PR commits
include that trailer.

AI-Assisted: Codex
2026-03-13 12:29:44 +00:00
Justin M. Keyes
9d052ddc79 test: set NVIM_TEST in zig build #38281
Problem:
Noise in zig CI logs:

    WRN 2026-03-13T03:12:58.742 ui/c/T140.75243.0 tui_handle_term_mode:239: TUI: terminal mode 69 detected, state 2
    WRN 2026-03-13T03:12:58.743 ui/c/T140.75243.0 tui_handle_term_mode:226: TUI: terminal mode 2026 unavailable, state 0
    WRN 2026-03-13T03:12:58.743 ui/c/T140.75243.0 tui_handle_term_mode:226: TUI: terminal mode 2027 unavailable, state 0

Solution:
Set NVIM_TEST.

Followup to d6bee7e407
2026-03-13 07:33:03 -04:00
Oleh Volynets
caf7808591 feat(diagnostic): custom status format function #36696
Problem:  Statusline component of diagnostics allows only the default
          format "sign:count".

Solution: Extend vim.diagnostic.Opts.Status to allow a custom signs
          or formatting function that provides the status presentation.
2026-03-13 07:21:45 -04:00
glepnir
7b8deacc3f fix(ui): preview float doesn't respond to mouse scroll #38270
Problem: The floating preview window (e.g. completion info)
has mouse=false, so scroll wheel events pass right through it.

Solution: Set mouse=true on the preview float so users can
scroll its content with the mouse wheel.
2026-03-13 06:17:10 -04:00
glepnir
3f10bb87ef fix(completion): wrong CompleteDone reason for auto-inserted sole match #38280
Problem: #38169 used compl_used_match to determine the CompleteDone
reason, but this fires too broadly, it also changes the reason to
"accept" when the popup was shown and the user dismissed it with <Esc>
or <Space>, breaking snippet completion with autocomplete.

Solution: Instead of checking compl_used_match in, check whether the pum
was never shown (compl_match_array == NULL) in ins_compl_stop().
When a match was inserted but the pum never displayed,
set the completed word so CompleteDone fires with reason "accept".
This keeps the "discard" reason intact when the user dismisses a visible
pum without confirming.
2026-03-13 06:13:58 -04:00
glepnir
f3ec657ebc fix(api): nvim_parse_cmd on range-only, modifier-only commands #36665
Problem: nvim_parse_cmd rejects valid commands like `:1` (range-only)
or `aboveleft` (modifier-only).

Solution: allow empty command when range or modifiers exist, and handle
execution using existing range command logic.
2026-03-13 06:06:39 -04:00
zeertzjq
b027de3a87 test: include :cd in pcall() in rmdir() (#38278)
If the Nvim session has exited, the nvim_command will fail too.

ERROR    test/functional/core/fileio_spec.lua @ 342: tmpdir failure modes
test\functional\testnvim.lua:133: sending request after EOF from Nvim

stack traceback:
	test\functional\testnvim.lua:133: in function 'command'
	test\functional\testnvim.lua:847: in function 'rmdir'
	test/functional/core\fileio_spec.lua:353: in function <test/functional/core\fileio_spec.lua:342>
2026-03-13 08:06:24 +08:00
zeertzjq
957eb1fde0 vim-patch:3697c6b: runtime(ssh): ignore case in 'keywordprg', update syntax script (#38277)
- ftplugin(sshdconfig): use "-I" for 'keywordprg' to search
  case-insensitive in the man page
- syntax(sshdconfig,sshconfig): Mark "lowdelay", "throughput", and
  "reliability" as deprecated for IPQoS, highlighting them as
  errors/warnings to reflect OpenSSH 10.1p1 release

Reference:
https://www.openssh.org/releasenotes.html#10.1p1

closes: vim/vim#19636

3697c6b020

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2026-03-12 23:45:04 +00:00
zeertzjq
878c9739e1 vim-patch:9.2.0147: blob: concatenation can be improved (#38276)
Problem:  blob: concatenation can be improved
Solution: Use ga_grow() to allocate space once and mch_memmove() to copy
          the blob data as a single block and fall back to the previous
          byte by byte append (Yasuhiro Matsumoto).

closes: vim/vim#19645

67deae3b77

Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
2026-03-12 23:28:26 +00:00
luukvbaal
52dd62aa6e fix(ui2): use pager to list consecutively typed commands #38272
Problem:  Mimicked block mode for cmdline entered while expanded
          does not work intuitively for repeated commands yielding
          messages exceeding the screen height. The expanded cmdline
          resizes and scrolls to bottom/top when appending a message
          and entering the cmdline. Also includes the entered command,
          as opposed to the UI1 behavior.
          Crash when scrolling to bottom of pager due to recursive
          uv_run after shell message callback executes `nvim_command()`
          with 'showcmd'.

Solution: Still mimic block mode when entering the expanded cmdline,
          but when the entered command emits a message open the pager
          with the current message content in the expanded cmdline.
          Always route typed commands to the pager when it is open.
          Use `nvim_buf_set_cursor()` instead of `nvim_command()`.
2026-03-12 18:38:39 -04:00
Lewis Russell
ce1154048b refactor: integer functions, optimize asserts #34112
refactor(lua): add integer coercion helpers

Add vim._tointeger() and vim._ensure_integer(), including optional base
support, and switch integer-only tonumber()/assert call sites in the Lua
runtime to use them.

This also cleans up related integer parsing in LSP, health, loader, URI,
tohtml, and Treesitter code.

supported by AI
2026-03-12 11:04:05 -04:00
Justin M. Keyes
2fe07cc965 Merge #37815 do_highlight change-detection of "gui" colors 2026-03-12 10:16:18 -04:00