Commit Graph

19371 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Justin M. Keyes
2fe07cc965 Merge #37815 do_highlight change-detection of "gui" colors 2026-03-12 10:16:18 -04:00
Justin M. Keyes
bc67976c95 docs: vimfn descriptions 2026-03-12 11:12:56 +01:00
Justin M. Keyes
96e6ce6619 docs: misc 2026-03-12 11:12:56 +01:00
glepnir
d87972f920 fix(pum): keep info window aligned with pum when above #38251
Problem:
When `pum_above` is set, the info window uses `anchor=SW`. Updating the
info window height during `CompleteChanged` causes its top edge to shift,
so it no longer aligns with the top of the pum.

Solution:
Use `NW` as the anchor even when `pum_above` is true so the info window
remains aligned with `pum_row`.
2026-03-12 05:48:14 -04:00
anondeveg
32aee065a8 feat(startup): warn if NVIM_LOG_FILE is inaccessible #38070
Problem:
If NVIM_LOG_FILE, or the default fallback, is inaccessible (e.g.
directory is owned by root), users get confused.

Solution:
Show a warning when $NVIM_LOG_FILE or $XDG_STATE_HOME are inaccessible.

Also fix a latent memory leak: `os_mkdir_recurse` returns a uv error
code (int), but it was stored as `bool`, causing `os_strerror` to
receive an invalid error code and leak memory.

See: https://docs.libuv.org/en/v1.x/errors.html#c.uv_strerror

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-03-12 04:40:07 -04:00
glepnir
d7903982ae refactor(highlight): extract set_gui_color() from do_highlight()
Problem: GUIFG, GUIBG, GUISP handling in do_highlight() is basically
the same code copy-pasted three times.

Solution: Pull the shared logic into a small set_gui_color() helper.
2026-03-12 14:25:14 +08:00
glepnir
d5a8c9d766 fix(highlight): correct change detection in do_highlight for gui colors
Problem: The GUIFG/GUIBG/GUISP handlers compare sg_rgb_{fg,bg,sp}
(RgbValue) against old_idx (color table index) instead of comparing
sg_rgb_{fg,bg,sp}_idx against old_idx, making did_change unreliable.

Solution: Use the _idx field for the index comparison and add the
missing sg_rgb_sp_idx assignment.
2026-03-12 14:25:14 +08:00
zeertzjq
f847aa6208 vim-patch:9.2.0140: file reading performance can be improved (#38266)
Problem:  Reading large files is slow because UTF-8 validation and
          newline scanning are performed byte-by-byte. Initial file
          loading also triggers listener and channel processing.
Solution: Use memchr() for SIMD-optimized newline scanning, implement
          word-at-a-time ASCII skipping during UTF-8 validation using a
          bitmask, skip listener/netbeans/channel notifications
          when the ML_APPEND_NEW flag is set during readfile()
          (Yasuhiro Matsumoto).

closes: vim/vim#19612

2ca96b09d7

Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Co-authored-by: NRK <nrk@disroot.org>
2026-03-12 10:28:03 +08:00
zeertzjq
e5667b9c15 vim-patch:9.2.0137: [security]: crash with composing char in collection range (#38261)
Problem:  Using a composing character as the end of a range inside a
          collection may corrupt the NFA postfix stack
          (Nathan Mills, after v9.1.0011)
Solution: When a character is used as the endpoint of a range, do not emit
          its composing characters separately. Range handling only uses
          the base codepoint.

supported by AI

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-9phh-423r-778r

36d6e87542

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-03-11 23:42:31 +00:00
zeertzjq
974bc1b044 fix(process): wrong exit code for SIGHUP on Windows (#38242)
Problem:
When stopping a PTY process on Windows, the exit code indicates that the
process is stopped by SIGTERM even when closing all streams is enough to
terminate the process. This is inconsistent with other platforms.

Solution:
Set exit_signal to SIGHUP instead of SIGTERM when using SIGHUP.
2026-03-12 06:45:22 +08:00
Rawan Khalid
8aacce90b4 fix(cmake): linker flags, doc generation for cross-compilation #38215
Problem:
Cross-compilation issues encountered when building Neovim for WASM.
When cross-compiling, three issues occur:
1. `-Wl,--no-undefined` — not supported by `wasm-ld` 
2. `-lutil` — not available in the Emscripten sysroot
3. Doc generation fails because CMake tries to execute `$<TARGET_FILE:nvim_bin>` on the host machine, which fails because the binary is not native to the host. It fails with `/bin/sh: nvim.js: Permission denied`

Solution:
The fix includes skipping `-Wl,--no-undefined` and `-lutil` with `NOT CMAKE_CROSSCOMPILING` and adding `NVIM_HOST_PRG` variable to `runtime/CMakeLists.txt` so when cross-compiling, it uses a host native nvim binary for doc generation instead of using the cross-compiled target.
2026-03-11 19:05:46 +00:00
Willaaaaaaa
689a149b08 fix(prompt): don't implicitly set 'modified' #38118
Problem:
In aec3d7915c Vim changed prompt-buffers
to respect 'modified' so the termdebug plugin can "control closing the
window". But for most use-cases  (REPL, shell, AI "chat", …),
prompt-buffers are in practice always "modified", and no way to "save"
them, so *implicitly* setting 'modified' is noisy and annoying.

Solution:
Don't implicitly set 'modified' when a prompt-buffer is updated.
Plugins/users can still explicitly set 'modified', which will then
trigger the "E37: No write since last change" warning.
2026-03-11 14:16:35 -04:00
Justin M. Keyes
682f5fee60 docs: misc
Close #37458
Close #37838
Close #37840
Close #37872
Close #37890
Close #38016
Close #38051
Close #38189
Close #38225
Close #38243
Close #38250

Co-authored-by: Colin Kennedy <colinvfx@gmail.com>
Co-authored-by: "Mike J. McGuirk" <mike.j.mcguirk@gmail.com>
Co-authored-by: Austin Rambo <ramboaustin13@gmail.com>
Co-authored-by: Jonathan Birk <1965620+cafce25@users.noreply.github.com>
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Co-authored-by: Mike Smith <10135646+mikesmithgh@users.noreply.github.com>
Co-authored-by: Saad Nadeem <saadndm.sn@gmail.com>
Co-authored-by: brianhuster <phambinhanctb2004@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Yi Ming <ofseed@foxmail.com>
2026-03-11 18:24:57 +01:00
Justin M. Keyes
a3058abf30 docs: deprecate hit-enter 2026-03-11 18:17:46 +01:00
Justin M. Keyes
b8a976afda docs: api, messages, lsp, trust
gen_vimdoc.lua: In prepare for the upcoming release, comment-out the
"Experimental" warning for prerelease features.
2026-03-11 18:00:18 +01:00
luukvbaal
e1b3ca6629 fix(compositor): clear old position with last known dimensions #38229
Problem:  When reconfiguring a float reallocates the grid before the old
          area is cleared, artifacts are left on the screen.
Solution: Use the last known compositor dimensions of a grid when
          clearing the area covered by the old position.

Co-authored-by: glepnir <glephunter@gmail.com>
2026-03-11 07:38:18 -04:00
Ayaan
a2f01953b8 fix(terminal): free the "[Process exited]" msg extmark #38246
Problem: Since the "[Process exited]" msg is no longer part of buffer
contents, `jobstart`'s reuse of unmodified finished terminal buffers
does not clear the msg.

Solution: Delete the extmark if `term` is already closed.
2026-03-11 05:13:38 -04:00
Commrade Goad
66066d0f6a fix(lua): extra CR (\r) in nvim -l output #38048
Problem:
`nvim -l` prints an extra `\r` to stdout:

    :=vim.system({'cmd', '/c',  "echo print(1) | nvim -l -"}, {}):wait()
    {
      code = 0,
      signal = 0,
      stderr = "1\r\r\n",
      stdout = ""
    }

Solution:
Check `headless_mode` in `msg_use_crlf`.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-03-10 19:01:45 -04:00
glepnir
e23c083d13 fix(highlight): avoid null deref, misc issues #38164
Problem: update_window_hl dereferenced the pmap_get result without a
NULL check. Also `tmp` had the wrong type and attr_id==0 was rejected
twice.

Solution: check the pointer before dereferencing, change `tmp` to
bool, and update the attr_id check to `< 0`.
2026-03-10 18:17:02 -04:00
Justin M. Keyes
2c5266429c Merge #37926 msg_show UI event indicates user-interactive 2026-03-10 17:53:11 -04:00
luukvbaal
b47b0caba8 fix(message): concatenate multi-chunk nvim_echo({err}) for exception message #38131
Problem:  Exception error message only prints the first chunk of a
          multi-chunk nvim_echo() message.
Solution: Concatenate consecutive message chunks in the exception
          message list.
2026-03-10 10:35:24 -04:00
Ayaan
c8693051a8 feat(terminal): surface exit code via virttext + nvim_get_chan_info #37987
Problem:
When a terminal process exits, "[Process Exited]" text is added
to the buffer contents.

Solution:
- Return `exitcode` field from `nvim_get_chan_info`.
- Show it in the default 'statusline'.
- Show exitcode as virtual text in the terminal buffer.
2026-03-10 08:02:50 -04:00
Kyle
5b5b7eb8d4 fix(tui): reset cursor to default style when guicursor is disabled #38219
Problem:
Cursor style is not set to default when guicursor is disabled. See
return early when guicursor is disabled (rather than resetting the
cursor style to terminal default).

Solution:
Send the appropriate DECSCUSR sequence to reset the cursor style when
guicursor is disabled.

Note that this does not fix #23122. The CSI sequence sent out depends on
the terminal in question. Ideally, it would would send `\x1b[0 q` to
reset the cursor style; the behavior of this sequence depends on the
terminal and configuration in question. See [Ghostty
docs](https://ghostty.org/docs/vt/csi/decscusr) for more details.

In practice, it sends out `\x1b[2 q` (steady block) for Ghostty, which
seems to be coming from the Unibilium database. I'm not sure what it may
send out for other terminals, but it doesn't exactly reset to the
default style.
2026-03-10 07:03:02 -04:00
zeertzjq
c1dcb8dac2 vim-patch:9.2.0131: potential buffer overflow in regdump() (#38217)
Problem:  Potential buffer overflow in regdump()
Solution: Add the size to the compiled regular expression and ensure we
          don't read over the limit.

Note: this is not a security issue, because regdump() is typically not
compiled in any version of Vim, so should not affect anybody.

supported by AI claude.

9360647715

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-03-10 10:47:07 +08:00
zeertzjq
9734a6ce47 vim-patch:9.2.0130: missing range flags for the :tab command (#38216)
Problem:  :tab accepts a tab address range but doesn't specify this in
          the command specification.
Solution: Add EX_RANGE and EX_ZEROR to the command specification and use
          ADDR_TABS (Doug Kearns).

As command modifers are handled separately before these flags are tested
in the ex-command parser they have no effect.  However, it's better to
use an accurate description and the command specification table has uses
in other areas like runtime file generation for the Vim filetype.

closes: vim/vim#19100

49b8d9903b

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-03-10 09:15:52 +08:00
zeertzjq
29fa072b34 vim-patch:partial:9.2.0126: String handling can be improved (#38214)
Problem:  String handling can be improved
Solution: Pass string length where it is known to avoid strlen() calls,
          do a few minor refactors (John Marriott).

This commit changes some calls to function `set_vim_var_string()` to pass
the string length where it is known or can be easily calculated.

In addition:
In `evalvars.c`:
  * In function `set_reg_var()` turn variable `regname` into a C string
    because that is how it used.
  * Small cosmetics.
In `option.c`:
  * Slightly refactor function `apply_optionset_autocmd()` to move some
    variables closer to where they are used.
In `getchar.c`:
  * Slightly refactor function `do_key_input_pre()`:
    -> change call to `dict_add_string()` to `dict_add_string_len()` and
       pass it the length of `buf`.
    -> only call `get_vim_var_string()` once.
In `message.c`:
  * Use a `string_T` to store local variable `p`.
In `normal.c`:
  * Move some variables closer to where they are used.

closes: vim/vim#19618

727f6e2686

Co-authored-by: John Marriott <basilisk@internode.on.net>
2026-03-10 09:13:30 +08:00
luukvbaal
a81b059a45 fix(messages): non-fast and append for "shell_*" kinds #38188
Problem:  vim.ui_attach() is unable to display streamed shell output,
          and will display it as individual messages.
          Unwanted newlines in "shell_ret" message.
Solution: Treat the "shell_*" kinds as non-fast and set msg_show->append
          for the streamed stdout/err messages.
          Remove leading newline from (translated) message with
          ext_messages, remove trailing newline altogether.
2026-03-09 19:24:01 -04:00
Stefan Novaković
bffca6e26b feat(extmark): support end_col=-1 if strict=false #28169
Problem:
There is an inconsistency between extmarks/highlights regarding the
`end_col` param.

Solution:
Allow end_col=-1 to mean "end of line" (if strict=false).

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-03-09 19:20:25 -04:00
Justin M. Keyes
3b94ab296f Merge #38206 nvim_win_set_config 2026-03-09 15:56:24 -04:00
rok
c4c2112b5d fix(runtimepath): crash in :packadd splice optimization #38129
Problem:
After #37722 splice optimization for :packadd, nvim crashes with SIGSEGV
on startup while running `runtime! lua/xxx/*` and sourced file executes
multiple `:packadd`.

Solution:
While `do_in_cached_path` is executing, it doesn't expect reference to
runtime_search_path changes. But when callback is called, and
add_pack_dir_to_rtp does 'splice' it may trigger realloc, and change
address. Check runtime_search_path_ref to prevent ref held by
do_in_cached_path changes.
2026-03-09 15:22:48 -04:00
Sean Dewar
4362132b10 fix(api): don't re-apply minimal style if unchanged #38152
Problem: nvim_win_set_config with style=minimal re-applies option values even if
the new style is unchanged from the old. This may be undesirable after #38122.

Solution: don't bother in this case.

See https://github.com/neovim/neovim/pull/38122#issuecomment-3996994189.
A reversal of https://github.com/neovim/neovim/pull/22865#discussion_r1161598973
so its associated test has been updated.
2026-03-09 14:28:36 -04:00
github-actions[bot]
1684ff9ded docs: update version.c #38084
vim-patch:9.2.0062: Using the wrong field with DAP channel mode
vim-patch:9.2.0064: popup: opacity feature causes flickering
vim-patch:9.2.0071: Vim9: lambda function deleted on re-sourcing
vim-patch:9.2.0082: Patch v9.2.0052 was wrong
vim-patch:9.2.0084: Vim9: isn_get_calltype() can be improved
vim-patch:a6550d571 translation: regenerate po/vim.pot after v9.2.0083
vim-patch:9.2.0086: Coverity complains that ScreenLines can be NULL
vim-patch:9.2.0087: popup: redrawing can be improved when moving popups
vim-patch:5a4291d34 runtime(osc52): Omit paste from the osc52 provider when g:osc52_disable_paste is enabled
vim-patch:93cb5e544 translation: regenerate po/vim.pot after v9.2.0088
vim-patch:9166f1c09 translation: regenerate po/vim.pot after v9.2.0093
vim-patch:f7a568ebe runtime(syntax-tests): regenerate dump files (after v9.2.0093)
vim-patch:22c62e269 runtime(syntax-tests): regenerate dump files (after v9.2.0110)
vim-patch:bd77d327d runtime(doc): remove thoughts of generics for a function
vim-patch:9.2.0114: MS-Windows: terminal output may go to wrong terminal
vim-patch:49b81793f runtime(docs): Update CONTRIBUTING.md and mention #vim on libera
vim-patch:9.2.0123: GTK: using deprecated gdk_pixbuf_new_from_xpm_data()

Co-authored-by: marvim <marvim@users.noreply.github.com>
2026-03-09 11:35:38 -04:00
glepnir
69419f8b3e fix(completion): CompleteDone reason="discard" when candidate text remains #38169
Problem: CompleteDone fires with reason="discard" even when the candidate
text was inserted and left in the buffer, because reason was determined
solely by the terminating keycode (Ctrl-Y).

Solution: Check compl_used_match to detect whether inserted
text remains in the buffer, and set reason="accept" accordingly.
2026-03-09 07:58:13 -04:00
Sean Dewar
0ee8323f2b fix(api): unnecessary errors when not moving split
Problem: nvim_win_set_config may raise unnecessary errors when not moving a
split.

Solution: skip checks related to moving when only maybe resizing a split.
2026-03-09 00:51:34 +00:00
Sean Dewar
e13e850517 fix(api): redraw after setting minimal style
Problem: No explicit redraw after setting style=minimal in nvim_open_win or
nvim_win_set_config, which may cause it to appear like it's not set.

Solution: call changed_window_setting after applying the style, which should be
enough for these options.
2026-03-09 00:23:08 +00:00
Daniel Müller
61f166ec40 fix(textformat): don't swallow "space" with auto-formatting enabled (#38181)
vim-patch:9.2.0124: auto-format may swallow white space

Problem:  With auto paragraph formatting enabled, when a user makes an
          attempt to add a new word before the end of a line and with
          the following space bringing the line width over 'textwidth',
          the space ends up just getting swallowed by the editor.
Solution: Detect such a constellation and do not auto-format in that
          case (Daniel Müller).

closes: vim/vim#19593

24fd698045
2026-03-08 23:58:14 +00:00
zeertzjq
9a9b9c581c vim-patch:9.2.0121: patch memory leak in list_extend_func() in list.c (#38205)
Problem:  memory leak in list_extend_func() in list.c
Solution: Free l1 on early return (Huihui Huang)

closes: vim/vim#19572

7ed37dc534

Co-authored-by: Huihui Huang <625173@qq.com>
2026-03-09 07:44:20 +08:00