Commit Graph

34578 Commits

Author SHA1 Message Date
Anatolii Sakhnik
a141fd2c4d fix(remote): remote-ui connect timeout on slow networks #36800
Problem:
Connecting to a remote Neovim fails on slow network:

```
$ nvim --remote-ui --server 10.0.3.100:11111
Remote ui failed to start: connection refused
```

Strace reveals that the connection wasn't actually refused, but was still in progress:
```
15:52:50.678223 socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 11
15:52:50.678278 setsockopt(11, SOL_TCP, TCP_NODELAY, [1], 4) = 0
15:52:50.678320 connect(11, {sa_family=AF_INET, sin_port=htons(11111), sin_addr=inet_addr("10.0.3.100")}, 16) = -1 EINPROGRESS (Дія зараз виконується)
15:52:50.678443 clock_gettime(CLOCK_MONOTONIC, {tv_sec=21736, tv_nsec=57625406}) = 0
15:52:50.678489 io_uring_enter(4, 3, 3, IORING_ENTER_GETEVENTS, NULL, 0) = 3
15:52:50.678544 epoll_pwait(3, [], 1024, 50, NULL, 8) = 0
15:52:50.728911 clock_gettime(CLOCK_MONOTONIC, {tv_sec=21736, tv_nsec=108159596}) = 0
15:52:50.729203 epoll_ctl(3, EPOLL_CTL_DEL, 11, 0x7ffd6ec9a3bc) = 0
15:52:50.729527 close(11)               = 0
```

Solution:
Increase hardcoded timeout from 50ms to 500ms.
2025-12-02 11:14:10 -05:00
luukvbaal
3277dc3b4e fix(ui): postpone UI callbacks during textlock #36803
Problem:  UI callbacks disregard textlock unnecessarily (since d909de2).

Solution: In case the UI is flushed during textlock, make sure Nvim does
          not flush UI callbacks that are expected to change text. Instead
          assume postponing callbacks during textlock is insignificant,
          and will safely happen soon after.
2025-12-02 10:51:22 -05:00
Chris Grieser
4e2ed1d03c fix(treesitter): missing nowait for :InspectTree keymaps #36804 2025-12-02 10:49:58 -05:00
Christian Clason
3e3624db64 build(deps): bump luajit to 6f21cb8ac 2025-12-02 14:25:41 +01:00
Justin M. Keyes
65141153d9 Merge #36792 unreliable tests 2025-12-02 01:06:40 -05:00
Justin M. Keyes
ebd758f809 test: unreliable "channel opened, ..., deleted by pressing a key"
Problem:
Test sometimes fails on macos:

    test/functional/terminal/channel_spec.lua:96: Expected objects to be the same.
    Passed in:
    (number) 3
    Expected:
    (number) 2

Solution:
Retry a few times.
2025-12-02 00:14:09 -05:00
Justin M. Keyes
c8f2b10a40 test: unreliable "job exit event on jobstart(…,{term=true})"
Problem:
Test often fails in cirrus (bsd) ci:

    FAILED   test/functional/terminal/channel_spec.lua @ 149: no crash when TermOpen autocommand processes job exit event when using jobstart(…,{term=true})
    test/functional/terminal/channel_spec.lua:158: Row 1 did not match.
    Expected:
      |*^ready $ foobar                                              |
      |*                                                            |
      |*[Process exited 0]                                          |
      |                                                            |
    Actual:
      |*^ready $                                                     |
      |*[Process exited 0]                                          |
      |*                                                            |
      |                                                            |

Solution:
Use one printf call instead of multiple.
2025-12-02 00:08:38 -05:00
benarcher2691
ad438b6b14 fix(ui): exclude hidden windows from tabline window count #36779
Problem: When `vim._extui` is enabled, the default tabline shows an
incorrect window count (e.g., "2" when only 1 window is visible). This
happens because the extui pager window has `focusable=true` (needed for
user interaction) but `hide=true` (not visible by default).

Solution: Modify the window counting logic in `statusline.c` and
`ex_docmd.c:ex_tabs()` to also exclude hidden windows
(`wp->w_config.hide`), not just non-focusable windows.

Also updates test expectations in `cmdline2_spec.lua` which previously
expected the incorrect window count "2" when extui was enabled. The test
now correctly expects no window count indicator when only 1 visible
window exists.

Fixes #36759
2025-12-01 23:57:56 -05:00
Elias Assaf
310d01d8fa fix(clipboard): tmux clipboard data may be stale #36787
Problem:
When Nvim wants to paste from tmux, it doesn't tell tmux to read the OS
clipboard first, so it may have stale clipboard state.

Solution:
Tickle `tmux refresh-client -l`, before requesting paste, as recommended
in the tmux manpage. https://man7.org/linux/man-pages/man1/tmux.1.html

Fixes https://github.com/neovim/neovim/issues/36786

Signed-off-by: Elias Assaf <elyas51000@gmail.com>
2025-12-01 21:52:40 -05:00
zeertzjq
832ce0ac4b vim-patch:c3cfdef: runtime(doc): clarify the use of v:errormsg (#36789)
fixes: vim/vim#18825

c3cfdefdee

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-12-02 00:38:18 +00:00
zeertzjq
ade9eac8ca vim-patch:cce452f: runtime(lf): update syntax to support lf version r39 (#36790)
closes: vim/vim#18846

cce452f52d

Co-authored-by: CatsDeservePets <145048791+CatsDeservePets@users.noreply.github.com>
2025-12-02 00:36:39 +00:00
zeertzjq
e45212101c Merge pull request #36773 from zeertzjq/funccal-refcount
fix(eval): fix crash with :breakadd expr when calling user func
2025-12-02 08:04:54 +08:00
zeertzjq
b64e36cef0 vim-patch:9.1.1943: Memory leak with :breakadd expr
Problem:  Memory leak with :breakadd expr
Solution: Free debug_oldval and debug_newval before assigning to them.
          Verify the existing (though confusing) :breakadd expr behavior
          (zeertzjq).

It seems that :breakadd expr doesn't work as documented at all. This PR
only fixes the memory leak. The tests are for the existing behavior.

closes: vim/vim#18844

a474de64df
2025-12-02 07:24:28 +08:00
zeertzjq
62de643b89 vim-patch:partial:9.0.1570: some tests are slow
Problem:    Some tests are slow.
Solution:   Make a few test cases faster.

bf63011a52

Only include the RunDbgCmd() to s:RunDbgCmd() change.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-02 07:08:34 +08:00
zeertzjq
9b15d4c756 vim-patch:9.0.0688: debugger does not display the whole command
Problem:    Debugger does not display the whole command.
Solution:   Set ea.cmd before checking for a breakpoint.

33b55b562b

The code change is already covered by #35019.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-02 07:08:34 +08:00
zeertzjq
8156eece24 fix(eval): fix crash with :breakadd expr when calling user func 2025-12-02 07:08:34 +08:00
Yochem van Rosmalen
b058a801e7 ci(lintdocurls): use sed -e flag to mark argument as command #36776
Problem:
Sed thinks the argument starting with `1i` (and triple backticks) is the
suffix for the backup file because it comes right after the `-i` flag.
See for example
https://github.com/neovim/neovim/actions/runs/19774967693/job/56665991723.

Solution:
Explicitly mark it as command using the `-e` flag.
2025-12-01 16:54:10 -05:00
benarcher2691
7f2d5d6883 fix(msgpack): use fixstr encoding for strings of length 20-31 #36737
Problem:
MessagePack fixstr format supports string lengths 0-31, but mpack_str()
only used fixstr for lengths < 20. Strings of 20-31 bytes were
incorrectly encoded as str8 (2-byte header) instead of fixstr (1-byte
header).

Solution:
Change the condition from `len < 20` to `len < 32` to match the
MessagePack specification.

This fix affects message timing which exposed a pre-existing race
condition in the channels_spec PTY test. The test now uses a helper
function to accumulate partial PTY reads, making it more robust.

Fixes #32784
2025-12-01 13:16:44 -05:00
Tristan Knight
1de77c608f fix(lsp): handle nil request in semantic tokens #36780
Allow the `request` parameter in `tokens_to_ranges` to be `nil` and
update version checking logic accordingly. This prevents errors when
the request is not present and improves robustness of semantic token
handling.
2025-12-01 12:51:04 -05:00
Sean Dewar
8ede293b8a docs(README): fix logo (#36778)
Old link presumably broken after the website's move to Hugo.
2025-12-01 15:18:22 +00:00
zeertzjq
5299967551 vim-patch:8.0.0287: debug mode: cannot access function arguments (#36772)
Problem:    Cannot access the arguments of the current function in debug mode.
            (Luc Hermitte)
Solution:   use get_funccal(). (Lemonboy, closes vim/vim#1432, closes vim/vim#1352)

c7d9eacefa

This patch was regressed in e50b545676.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-01 13:19:27 +08:00
zeertzjq
b12ba37bcd Merge pull request #36771 from zeertzjq/vim-9.1.1937
vim-patch:9.1.{1937,1938,1939}
2025-12-01 11:34:59 +08:00
zeertzjq
d13e8f1a34 vim-patch:9.1.1939: tests: test_matchfuzzy() leaves swapfiles behind
Problem:  tests: test_matchfuzzy() leaves swapfiles behind
Solution: Close loaded buffers using "%bw"

6e9694df10

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-12-01 11:06:39 +08:00
zeertzjq
c9f63d13b6 vim-patch:9.1.1938: tests: excessive wait in Test_matchfuzzy_initialized
Problem:  tests: excessive wait in Test_matchfuzzy_initialized
Solution: Use term_wait() instead of the TermWait() wrapper
          (Corey Hickey)

Test_matchfuzzy_initialized is a terminal test, which are specified to be
"flaky" and automatically retried. The TermWait wrapper multiplies the
specified wait time by higher values for later retries, maxing out at
10x the specified value. This makes tries vim/vim#3 to vim/vim#6 sleep for 20 seconds
each, which makes the test very slow to work with. The specified intent
of the test (as noted in a comment eight lines above here) is to
sleep for 2s.

closes: vim/vim#18822

d4f9de889b

Co-authored-by: Corey Hickey <bugfood-c@fatooh.org>
2025-12-01 11:06:39 +08:00
zeertzjq
3c60598239 vim-patch:9.1.1937: tests: Test_matchfuzzy_initialized() fails
Problem:  tests: Test_matchfuzzy_initialized() fails
Solution: Send a dummy key (Corey Hickey)

Test_matchfuzzy_initialized seems to expect that the 'lvimgrep' will be
interrupted by sending a SIGINT. If the search finishes beforehand,
though, then the SIGINT triggers vim to tell the user how to quit.

Vim does not show this message immediately, though; instead, vim shows
the message next time it is active. When StopVimInTerminal() sends a key
sequence intended to cause vim to quit, this activates vim to show the
message instead of quitting.

I do not understand every detail of the problem fully--if I type the
characters from StopVimInTerminal() into a post-SIGTERM terminal
directly, that seems to work ok; there seems to be a timing issue due to
sending all the characters at once.

This fix does make the test work reliably for me, and the test still
works even if I limit my CPU frequency so that the search is interrupted
by the SIGINT.

fixes: vim/vim#18821
related: vim/vim#18822

a3925d783a

Co-authored-by: Corey Hickey <bugfood-c@fatooh.org>
2025-12-01 11:06:39 +08:00
Olivia Kinnear
acfb9bc614 feat(lsp): graduate ClientConfig exit_timeout #36750
Problem:
The `flags` field calls its sub-fields "experimental".
But `exit_timeout` is now used for multiple purposes.

Solution:
Graduate `exit_timeout` to a top-level ClientConfig field.
2025-11-30 21:41:43 -05:00
zeertzjq
3f8e51cee7 vim-patch:9.1.1936: filetype: Erlang lexical files are not recognized
Problem:  filetype: Erlang lexical files are not recognized
Solution: Detect *.xrl files as leex filetype, include syntax and
          filetype plugins (Jon Parise).

leex is the lexical analyzer generator for Erlang. Its input file format
follows a section-based structure and uses the `.xrl` file extension.

This initial work includes file detection, an ftplugin (which inherits
the Erlang configuration), and a syntax definition.

Reference:
-  https://www.erlang.org/doc/apps/parsetools/leex.html

related: vim/vim#18819
closes: vim/vim#18832

b087c5452b

Co-authored-by: Jon Parise <jon@indelible.org>
2025-12-01 10:11:34 +08:00
zeertzjq
8310f20526 vim-patch:9.1.1935: filetype: not all Erlang files are recognized
Problem:  filetype: not all Erlang files are recognized
Solution: Detect *.app.src and rebar.config files as erlang filetype
          (John Parise).

*.app.src files contain Erlang application definitions. (There are also
*.app files, which are similar but more often build artifacts, and that
file extension is too ambiguous to be recognized by default.)

Reference:
- https://www.erlang.org/doc/system/applications.html

Rebar is the Erlang build tool. rebar.config uses Erlang syntax.

Reference:
- https://rebar3.org/docs/configuration/configuration/

closes: vim/vim#18835

2b2580e61a

Co-authored-by: Jon Parise <jon@indelible.org>
2025-12-01 10:11:34 +08:00
Tristan Knight
23ddb2028b feat(lsp): semanticTokens/range #36705
Problem:
Nvim supports `textDocument/semanticTokens/full` and `…/full/delta`
already, but most servers don't support `…/full/delta` and Nvim will try
to request and process full semantic tokens response on every buffer
change. Even though the request is debounced, there is noticeable lag if
the token response is large (in a big file).

Solution:
Support `textDocument/semanticTokens/range`, which requests semantic
tokens for visible screen only.
2025-11-30 21:06:56 -05:00
CompileAndConquer
f9ef1a4cab fix(buffer): defer w_buffer clearing to prevent dict watcher crash #36748 2025-11-30 20:56:53 -05:00
zeertzjq
cdc6f85111 vim-patch:a4c43a6: runtime(vim): Update base syntax, match full :language command (#36766)
closes: vim/vim#18808

a4c43a6cf5

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-12-01 09:24:33 +08:00
zeertzjq
14d65dae91 fix(buffer): don't allow changedtick watcher to delete buffer (#36764) 2025-12-01 09:14:14 +08:00
fredizzimo
6ebeb07c56 feat(api): experimental nvim__exec_lua_fast #35758
Problem:
Remote UIs can't execute lua code when a blocking prompt is waiting for
input. This is needed when implementing IME pre-edit for example.

Solution:
Add an `nvim__exec_lua_fast` experimental API function, which is allowed
to run instead of being queued until after the message has been shown.
2025-11-30 19:27:02 -05:00
Justin M. Keyes
d62bbe24cb fix(tui): enable vtpcon strikethrough feature #36762
Problem:
Strikethrough was not enabled for vtpcon thus preventing strikethrough
text from being shown.

Solution:
Update `windows.ti`.

Co-authored-by: ymich9963 <gmichael834@gmail.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-11-30 11:22:12 -05:00
zeertzjq
8c1327a622 vim-patch:49f731d: runtime(doc): Improve :help :catch command specification (#36758)
The pattern argument is optional.  See :help :sort for another example.

closes: vim/vim#18834

49f731d243

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-11-30 18:55:38 +08:00
Olivia Kinnear
12d4c624bb feat(ex_cmds): consistent :restart behavior (#36723) 2025-11-30 02:14:28 -08:00
ymich9963
c87d92c3b4 fix(ui.open): use "start" instead of deprecated "rundll32" #36731
Problem:
The rundll32 utility is a leftover from Windows 95, and it has
been deprecated since at least Windows Vista.

Solution:
Use the start command through Command Prompt instead.
2025-11-30 00:11:43 -05:00
Riley Bruins
03d6cf7aae feat(lsp): support version in textDocument/publishDiagnostics #36754
This commit makes it so that push diagnostics received for an outdated
document version are ignored.
2025-11-29 23:38:11 -05:00
benarcher2691
5bb8734fb6 build(windows): vendor xxd.c #36746
Problem:
Currently we fetch a prebuilt xxd.exe from neovim/deps for Windows,
which is not ideal in terms of obviousness, misses updates, and is
clumsy to update.

Solution:
Similar to tee.c (#36363), vendor xxd.c from Vim and build it as part
of the Neovim build process. This makes the source obvious, enables
analyzer checks, and simplifies updates.

Fixes #36664
2025-11-29 23:15:47 -05:00
zeertzjq
242261554e Merge pull request #36749 from janlazo/vim-9.0.0057
vim-patch:9.0.{10,57,113}
2025-11-30 10:31:43 +08:00
Jan Edmund Lazo
26641c0c56 vim-patch:9.0.0010: returning 0 for has('patch-9.0.0') is inconsistent
Problem:    Returning 0 for has('patch-9.0.0') is inconsistent.
Solution:   Make it return 1. (closes vim/vim#10640)

b0375d466e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-11-29 20:59:24 -05:00
Olivia Kinnear
a4b2192690 feat(lsp): lsp.enable() auto-escalates forced shutdown #36458
Problem:
LSP server may not exit even after the client was stopped/disabled via enable(false).

Solution:
Automatically force-stop after a timeout, unless `client.flags.exit_timeout = false`.
2025-11-29 14:36:29 -05:00
Jan Edmund Lazo
d4a8d169a2 vim-patch:9.0.0113: has() is not strict about parsing the patch version
Problem:    has() is not strict about parsing the patch version.
Solution:   Check the version more strictly. (Ken Takata, closes vim/vim#10752)

d90f91fe30

Co-authored-by: K.Takata <kentkt@csc.jp>
2025-11-29 13:32:07 -05:00
Evgeni Chasnovski
28ff4deda7 fix(colorscheme): adjust StatusLine[NC] for diagnostics #36719
Problem: It is desirable for the default statusline to contain colored
  diagnostics information. However, current `StatusLine` group is
  purposefully defined as almost inverted `Normal` to "make current
  window obvious". This makes diagnostic information from
  `vim.diagnostic.status()` barely visible: it uses established
  `DiagnosticSignXxx` groups which have colored foreground with
  lightness close to `StatusLine` background.

  Also the `StatusLineNC` group is fairly different from `Normal` in
  order to both "makes window separators clear" and "be different from
  `CursorLine`". But not as mush different as `StatusLine` because
  "`StatusLine` and `StatusLineNC` should be clearly different".

Solution: Make both `StatusLine` and `StatusLineNC` be slightly closer
  in lightness to `Normal`. This makes `StatusLine` and `StatusLineNC`
  groups satisfy their conditions in the following way:
  - `vim.diagnostic.count()` is readable on `StatusLine` - yes.
  - `vim.diagnostic.count()` is readable on `StatusLineNC` - yes.
  - `StatusLine` makes current window obvious - I'd say yes.
  - `StatusLine` and `StatusLineNC` are clearly different - it depends
    on the eyes and monitor. The current is clearly better, but the new
    ones I'd say are still visibly different.
  - `StatusLineNC` makes window separators clear - I'd say yes, but
    depends on the eyes and monitor.
  - `StatuslineNC` is different from `CursorLine` - NO, they are same.

  Another approach to solve this would be to introduce dedicated
  `DiagnosticStatuslineXxx` groups to use in `vim.diagnostics.status()`.
  They can be defined using foreground colors from the same lightness as
  `Normal`. This would make them readable in `StatusLine`. But not
  `StatusLineNC`, though.
2025-11-29 12:36:05 -05:00
Jan Edmund Lazo
0d3ee26860 vim-patch:9.0.0057: has('patch-xxx') returns true
Problem:    has('patch-xxx') returns true.
Solution:   Check for digit. (closes vim/vim#10751)

5154a88800

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-11-29 10:31:14 -05:00
zeertzjq
a950e8ea9d vim-patch:ab09099: runtime(netrw): fix undefined variable curwin in s:NetrwMenu() (#36744)
fixes: vim/vim#18829

ab090993ad

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-11-29 00:35:34 +00:00
zeertzjq
da6edcb91b vim-patch:9.1.1934: filetype: not all starlark files are recognized (#36743)
Problem:  filetype: not all starlark files are recognized
Solution: Detect *.sky files as starlark filetype (Bruno Belanyi)

References:
- https://docs.bazel.build/versions/0.17.1/skylark/spec.html

closes: vim/vim#18807

3ba6a97fea

Co-authored-by: Bruno Belanyi <bruno@belanyi.fr>
2025-11-29 00:31:52 +00:00
zeertzjq
8c4e675983 vim-patch:afd46fd: runtime(doc): Correct typo in usr_30.txt regarding softtabstop (#36742)
Fix typo in explanation of softtabstop and shiftwidth.

closes: vim/vim#18823

afd46fd9c9

Co-authored-by: Shin Rag <62047911+aquanjsw@users.noreply.github.com>
2025-11-29 00:22:24 +00:00
Andrew Braxton
fd47bc2f04 fix(restart): preserve original args on repeat invocations #36740
Problem:

Calling `:restart` twice erases the original args passed to `nvim`. This
is caused by interactions between the `:restart` command handler, the
`v:argv` parsing logic in the UI restart handler, and the options added
to `v:argv` by the server upon restart.

For example,
* Launch `nvim` as `nvim foo`:
  * initial argv: `nvim foo`
  * after nvim server launch: `nvim --embed foo`
* Run `:restart`
  * after `ex_restart()`: `nvim -c '' --embed foo`
  * after `remote_ui_restart()`: `nvim -c '' foo`
  * after nvim server launch: `nvim --embed -c '' foo`
* Run `:restart` again
  * after `ex_restart()`: `nvim -c '' --embed -c '' foo`
  * after `remote_ui_restart()`: `nvim -c ''`
  * after nvim server launch: `nvim --embed -c ''`

The intention of the argv parser in `remote_ui_restart()` is to only
take the first `-c cmd` and ignore any additional ones, but it actually
ignores the rest of argv when it encounters a second `-c` and there are
no `-` or `--` remaining.

Solution:

Fix the argv parser to reset the `skipping_minc` flag at the end of
every iteration that does not reach the `continue` statement.
2025-11-28 15:29:34 -08:00
Justin M. Keyes
9f90992934 fix(scripts): gen_terminfo clears Windows terminfo definitions #36736
Problem:
`gen_terminfo.lua` clears out Windows terminfo definitions:

    rm -r /tmp/nvim_terminfo
    nvim -ll src/gen/gen_terminfo.lua

`src/nvim/tui/terminfo_builtin.h`:

    static const TerminfoEntry vtpcon_terminfo = {
      .bce = false,
      .has_Tc_or_RGB = false,
      .Su = false,
      .max_colors = -1,
      .lines = -1,
      .columns = -1,
      .defs = {
        [kTerm_carriage_return] = NULL,
        [kTerm_change_scroll_region] = NULL,
        [kTerm_clear_screen] = NULL,
        [kTerm_clr_eol] = NULL,
        [kTerm_clr_eos] = NULL,
        [kTerm_cursor_address] = NULL,
        [kTerm_cursor_down] = NULL,
        [kTerm_cursor_invisible] = NULL,
        [kTerm_cursor_left] = NULL,
        [kTerm_cursor_home] = NULL,
        [kTerm_cursor_normal] = NULL,
        [kTerm_cursor_up] = NULL,
        [kTerm_cursor_right] = NULL,
        [kTerm_delete_line] = NULL,
        ...

Solution:
Generate the database in 2 steps, don't concatenate the sources.
2025-11-28 15:04:49 -08:00