Commit Graph

10064 Commits

Author SHA1 Message Date
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
glepnir
63594ffa04 feat(lsp): do completionItem/resolve if completeopt=popup #32820
Problem:
No completionItem/resolve handler.

Solution:
If completeopt=popup is set, invoke completionItem/resolve when
a completion item is selected. Show resolved documentation in popup next
to the completion menu.
2026-03-11 05:48:31 -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
zeertzjq
b897e81b30 test(api/vim_spec): fix flaky test (#38227)
Problem:
Exit code in :terminal channel test depends on whether the shell or Nvim
TUI in the terminal has registered its SIGHUP handler when jobstop() is
called.

Solution:
Don't use a shell as shells on different systems may handle SIGHUP
differently. Add a screen:expect() to wait for the TUI to start.
2026-03-11 10:12:24 +08:00
zeertzjq
3a7ade847f vim-patch:9.2.0132: tests: Test_recover_corrupted_swap_file1 fails on be systems (#38238)
Problem:  tests: Test_recover_corrupted_swap_file1 fails on big-ending
          systems (after v9.2.0077)
Solution: Skip the test on big-endian systems (James McCoy)

The POC files were generated on 64-bit little-endian systems and
therefore are not portable to any other system type.

Extract the 64-bit / endianness detection from
Test_recover_corrupted_swap_file() into a SetUp() function and use that
data to determine if the test should be run.

closes: vim/vim#19620

ff16ebdb08

Co-authored-by: James McCoy <jamessan@debian.org>
2026-03-11 07:48:36 +08: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
Justin M. Keyes
2c5266429c Merge #37926 msg_show UI event indicates user-interactive 2026-03-10 17:53:11 -04:00
MP430
b3324be0d8 fix(man.lua): :Man ignores section of gzipped manpage #38235
Problem:
Under certain circumstances (e.g. gzipped manpages with mandoc),
:Man will not find the correct page because it does not process
multiple extensions correctly.
For example, with a file named strcpy.3p.gz, it will only check the .gz
part to try to check the section.
This leads to some pages being inaccessible because it will return the
page from the wrong section.

Solution:
Loop and try multiple extensions to try to find one which matches
the name of the section.
Also refactor the man.get_path function so that it can be tested.
2026-03-10 17:26:40 -04:00
glepnir
145548a24a feat(lsp): show snippet preview if completeopt=popup #32553
Problem:
LSP completion does not show snippet preview.

Solution:
Show snippet preview if 'completeopt' includes popup.
2026-03-10 14:34:58 -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
Yi Ming
0cc4f53b40 fix(lsp): do not clear the codelens on the last line #38226
Problem
The logic that clears codelenses beyond the buffer also removes the codelenses on the last line.

Solution
Do not clear the codelens on the last line.
2026-03-10 07:36:29 -04: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
Justin M. Keyes
de4f4dc807 Merge #37985 fix(lsp): adjust codelens position by range, ensure first-line visibility 2026-03-09 14:48:30 -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
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
f21c56da84 vim-patch:9.2.0125: tests: test_textformat.vim leaves swapfiles behind
Problem:  tests: test_textformat.vim leaves swapfiles behind
Solution: Close open buffer using :bw! instead of :close!

271f4fe47b

N/A patches:
vim-patch:9.2.0122: Vim still supports compiling on NeXTSTEP
vim-patch:bab7619: runtime(doc): Update intro.txt about Neovim

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-03-09 07:05:47 +08:00
zeertzjq
f1e65bde02 vim-patch:9.2.0120: tests: test_normal fails
Problem:  tests: test_normal fails
Solution: Ensure the terminal width is 40 columns and also
          check for existence of the tr.mo file

closes: vim/vim#19608

123a1e6410

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-03-09 07:05:47 +08:00
zeertzjq
504327020d vim-patch:9.1.1484: tests: Turkish locale tests fails on Mac
Problem:  tests: Turkish locale tests fails on Mac
          (after v9.1.1480)
Solution: skip the test Test_pos_percentage_in_turkish_locale() on Mac

223189389a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-03-09 07:05:46 +08:00
Sean Dewar
137d5ab01d fix(api): merge split window config only on success
Problem: nvim_win_set_config may merge configs despite failing to configure a
split, and without applying necessary side-effects (like setting style=minimal
options). Plus, autocommands may apply a different config after the merge,
causing side-effects to apply for an outdated config.

Solution: merge configs last, only on success. Include fields only relevant to
splits. Properly set _cmdline_offset for splits.

Maybe better to disallow _cmdline_offset for splits instead, as the pum is
relative to cmdline_row anyway? (I didn't want to change behaviour too much)

Also use expect_unchanged in an unrelated test to quash a warning.
2026-03-08 19:41:33 +00:00
Sean Dewar
f5d03ec930 fix(api): style=minimal not applied immediately for unmoved split
Problem: nvim_win_set_config with style="minimal" does not take immediate effect
when a split is not moved.

Solution: don't skip nvim_win_set_config's epilogue when only a resize may be
needed. De-duplicate resize logic and remove unnecessary redraw. (win_set*_win
already handles that)
2026-03-08 19:41:33 +00:00
altermo
72d3a57f27 feat(treesitter): incremental selection
Co-authored-by: György Andorka <gyorgy.andorka@protonmail.com>
2026-03-08 11:07:49 +01:00
Yi Ming
40dc2d02a8 fix(lsp): ensure the codelens on the first line is visible 2026-03-08 11:32:50 +08:00
Yi Ming
378435968f fix(lsp): adjust codelens position based on the server-provided range 2026-03-08 10:42:38 +08:00
zeertzjq
f1c82be1a1 test(shell-test): call tcdrain() on stdout and stderr on exit (#38177)
Similar to #38154, shell-test also has the same problem on FreeBSD:

FAILED
1 test, listed below:
FAILED
test/functional/terminal/ex_terminal_spec.lua @
237:
:terminal (with fake shell) executes a given command through the shell
test/functional/terminal/ex_terminal_spec.lua:239: Row 1 did not match.
Expected:
  |*^ready $ echo hi                                   |
  |*                                                  |
  |*[Process exited 0]                                |
  |                                                  |
Actual:
  |*^                                                  |
  |*[Process exited 0]                                |
  |*                                                  |
  |                                                  |
To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.
Snapshot:
screen:expect([[
  ^                                                  |
  [Process exited 0]                                |
                                                    |*2
]])
stack traceback:
	test/functional/ui/screen.lua:909: in function '_wait'
	test/functional/ui/screen.lua:537: in function 'expect'
	test/functional/terminal/ex_terminal_spec.lua:239: in function <test/functional/terminal/ex_terminal_spec.lua:237>

Running the test repeatedly somehow doesn't trigger the problem, but as
mentioned in #36792 a similar problem has also happened previously.
2026-03-07 11:28:35 +08:00
luukvbaal
b6c020eb59 fix(ui2): ensure expanded cmdline is closed after :<Esc> (#38187)
Problem:  Expanded cmdline is left open after entering the cmdline again
          without entering a command that emits another message (after 301c7065).
Solution: Wait for msg_show to reinstate the vim.on_key() handler.
          If there was no message close the expanded cmdline.
2026-03-07 00:40:01 +00:00
luukvbaal
301c7065ca fix(ui2): only highlight Ex command lines in the cmdline #38182
Problem:  Prompts and message text (in block mode) in the cmdline are
          parsed and highlighted as if it is Vimscript.
          Entering the cmdline while it is expanded can work more like
          it does with UI1, where the press enter prompt is replaced
          and previous messages stay on the message grid, while
          subsequent messages are placed below it.
Solution: Highlight manually with string parser on lines starting with ':'.
          Spoof cmdline block mode when the cmdline is entered while it
          is expanded.
2026-03-06 13:29:20 -05:00
luukvbaal
fde1c07891 fix(cmdline): cmdline_block events for :lua debug.debug() #38171
Problem:  :lua debug.debug() is missing cmdline_block events.
Solution: Emit cmdline_block_show/append/hide events for :lua
          debug.debug().
2026-03-06 13:17:12 -05:00
luukvbaal
6275f533d1 fix(ui2): immediately open target windows on new tabpage (#38170)
Problem:  Previous tests for this relied on other events opening the
          targets, which are not guaranteed to happen.
Solution: Open target windows when entering a new tabpage.
2026-03-06 17:32:17 +01:00
glepnir
d19dc6339d fix(api): nvim_set_hl crashes when url= key is passed
Problem: Calling nvim_set_hl() with url= crashes because it tries to
free arena-owned string memory.

Solution: Remove the bad free and return a validation error instead.
2026-03-06 10:54:28 +01:00
zeertzjq
deadff3060 test(shell-test): check MSWIN instead of _MSC_VER (#38178)
SetConsoleOutputCP() is likely needed when using MinGW as well.
It seems that zig build uses MinGW.
2026-03-06 15:11:55 +08:00
zeertzjq
066891f5d3 revert: "fix(tui): server --listen error sometimes not visible (#38027)" (#38175)
This reverts commit ab8371a26c.

Need to think of a different solution, which may require adding new
flags to nvim_ui_attach() (e.g. passing stdout or stderr fd).
2026-03-06 08:49:09 +08:00
zeertzjq
5048d9aa2a fix(tui): call tcdrain() on stdout and stderr on exit (#38154)
Problem:
On FreeBSD, output written to TTY may be lost on exit.
Example test failure:

FAILED
test/functional/terminal/tui_spec.lua @
2521:
TUI no assert failure on deadly signal #21896
test/functional/terminal/tui_spec.lua:2523: Row 1 did not match.
Expected:
  |*Nvim: Caught deadly signal 'SIGTERM'              |
  |*                                                  |
  |*[Process exited 1]^                                |
  |*                                                  |
  |*                                                  |
  |                                                  |
  |{5:-- TERMINAL --}                                    |
Actual:
  |*                                                  |
  |*[Process exited 1]{100:^                                }|
  |*{100:~                                                 }|
  |*{100:~                                                 }|
  |*{3:[No Name]                                         }|
  |                                                  |
  |{5:-- TERMINAL --}                                    |
To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.
Snapshot:
screen:expect([[
                                                    |
  [Process exited 1]{100:^                                }|
  {100:~                                                 }|*2
  {3:[No Name]                                         }|
                                                    |
  {5:-- TERMINAL --}                                    |
]])
stack traceback:
	test/functional/ui/screen.lua:909: in function '_wait'
	test/functional/ui/screen.lua:537: in function 'expect'
	test/functional/terminal/tui_spec.lua:2523: in function <test/functional/terminal/tui_spec.lua:2521>

Solution:
Call tcdrain() on stdout and stderr on exit.

This problem is only observed on FreeBSD, but it probably doesn't hurt
to do this on all platforms with termios.h. In fact using tcdrain() on
PTY slave is no-op on Linux according to Linux kernel source code.
2026-03-05 10:48:07 +08:00
Lewis Russell
8bfb91accc fix(lsp): ignore stale codelens resolve responses (#38153) 2026-03-04 17:43:40 -08:00
Stefan VanBuren
01817eb6f3 fix(treesitter): normalize language aliases
Hyphenated language names are silently dropped when used as injections
(see #38132).

This combines the normalization of language aliases into `resolve_lang`,
and also adds the normalization of hyphens to underscores, which allows
for handling of injected language tags with hyphens in their names.

Fixes #38132.
2026-03-04 17:15:59 +01:00
zeertzjq
813457d5a6 build: adjust parallel functionaltest target names (#38144)
- Use double underscores for the group targets as these targets usually
  shouldn't be used directly.
- Use dash instead of underscore in the two targets that need to be used
  directly. I'm not entirely sure about this, as both chars are used in
  many targets, but a dash is easier to type than an underscore.
2026-03-04 08:53:20 +08:00
Evgeni Chasnovski
f00abc6a56 fix(pack): ensure data spec is passed in events during lockfile sync #38139
Problem: During initial "bootstrap" via lockfile synchronization, the
  whole plugin specification is reconstructed from the lockfile data,
  ignoring potential user changes added in the first `vim.pack.add()`.
  This is enough in most situations since it is the only data needed
  for actual installation.

  However, this affects specification passed to `PackChanged[Pre]`
  events. In particular, `data` field is missing which can be a problem
  if there is a `PackChanged kind=install` hook that uses that field
  (like with some kind of `build` method used during install).
  And there might be different `version` set in `vim.pack.add()`.

Solution: Pass the `specs` input of the first `vim.pack.add()` down to
  lockfile synchronization and use it to reconstruct plugin
  specification for the to-be-installed plugin. If present among the
  user's `specs`, it is used but with forced `src` from the lockfile (as
  it is the one used during installation).

  Note that this still has a caveat when using separate
  `vim.pack.add()`, as only the specs from the first input (when the
  lockfile synchronization happens) is taken into account.
2026-03-03 19:16:24 -05:00
zeertzjq
6ddcc84a6c vim-patch:9.2.0102: 'listchars' "leadtab" not used in :list (#38142)
Problem:  'listchars' "leadtab" not used in :list (after 9.2.0088).
Solution: Also check for "leadtab" when using :list. Fix memory leak on
          E1572 if "multispace" or "leadmultispace" is set (zeertzjq).

closes: vim/vim#19557

5845741d69
2026-03-03 23:42:05 +00:00
Luuk van Baal
97549ad7cf feat(ui): specify whether msg_show event comes from typed command
Problem:  Unable to tell whether a msg_show event is emitted as a result
          a command typed on the cmdline (UI may want to represent these
          differently from other messages).
Solution: Add trigger parameter that is set to "typed_cmd" for
          a message emitted due to an interactively typed command.
          Possible extensions are mapping/timer/event but it's hard to
          imagine a UI distinguishing those so not added here.
2026-03-03 18:05:42 +01:00
Sean Dewar
1901832f26 fix(api): return "style" in nvim_win_get_config() #38122
Problem: nvim_win_get_config() does not return a window's "style".

Solution: always include it, and document `style=""`.

Always included so it can be used reciprocally with nvim_open_win() or
nvim_win_set_config(). (otherwise the config of a window with kWinStyleUnused
will not unset the kWinStyleMinimal style of another window if passed to
nvim_win_set_config, for example)
2026-03-03 12:17:20 +00:00
glepnir
84d84e9b5b fix(window): style=minimal window loses local options when switching buffers #38138
Problem: 5943a81 skips saving window options in `buflist_altfpos` for
style=minimal windows, which also prevents the window from restoring its own
options when switching buffers.

Solution: revert the change. In `get_winopts`, don't restore options from the
`WinInfo` of style=minimal windows when reusing values for a different window.
In `win_free`, clear `wi_optset` for minimal windows.
2026-03-03 11:51:58 +00:00
zeertzjq
518aa46158 vim-patch:9.2.0090: "leadtab" behavior inconsistent on line with only TABs
Problem:  "leadtab" behavior inconsistent on line with only TABs
          (after 9.2.0088).
Solution: Don't consider those as leading TABs. Also add more tests for
          existing behavior of "lead" and "leadmultispace" (zeertzjq).

closes: vim/vim#19549

4b30e40a1f
2026-03-03 08:08:20 +08:00
zeertzjq
3e81072293 vim-patch:9.2.0088: cannot display tabs for indentation
Problem:  cannot display tabs for indentation
Solution: Add the "leadtab" value to the 'listchars' option to
          distinguish between tabs used for indentation and tabs used
          for alignment (HarshK97).

closes: vim/vim#19094

8526d32647

Co-authored-by: HarshK97 <harshkapse1234@gmail.com>
2026-03-03 08:05:58 +08:00
zeertzjq
ab8371a26c fix(tui): server --listen error sometimes not visible (#38027)
Problem:  If Nvim server fails to --listen and prints error before the
          TUI enters alternate screen, the error isn't visible.
Solution: Forward server stderr using client side stderr handler instead
          of having the server inherit client stderr file descriptor.

This does mean that `stderr_isatty` will be `false` in the server, but
that value doesn't matter in embedded mode.

Always pass `stdin_fd` to embedded server to avoid a hang when reading
from stdin when it's a TTY (not sure why one wants to do that, perhaps
by mistake), because if `stdin_fd` isn't passed, the server will try to
use stderr as stdin.

Example test failure on CI:

FAILED   test/functional/terminal/tui_spec.lua @ 41: TUI exit status 1 and error message with server --listen error #34365
test/functional/terminal\tui_spec.lua:55: Failed to match any screen lines.
Expected (anywhere): "nvim%.exe: Failed to %-%-listen: address already in use:"
Actual:
  |{114:nvim.exe -h"}                                                |
  |                                                            |
  |[Process exited 1]^                                          |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |{5:-- TERMINAL --}                                              |

Snapshot:
screen:expect([[
  {114:nvim.exe -h"}                                                |
                                                              |
  [Process exited 1]^                                          |
                                                              |*13
  {5:-- TERMINAL --}                                              |
]])

stack traceback:
	test\functional\ui\screen.lua:909: in function '_wait'
	test\functional\ui\screen.lua:537: in function 'expect'
	test/functional/terminal\tui_spec.lua:55: in function <test/functional/terminal\tui_spec.lua:41>

In this case, it appears that the client entered alternate screen in the
middle of the server's print_mainerr().
2026-03-02 20:39:05 +08:00
zeertzjq
0ae8168c99 test(terminal/cursor_spec): only delete TermOpen autocmds (#38123) 2026-03-02 00:07:46 +00:00