Commit Graph

35521 Commits

Author SHA1 Message Date
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
Sanzhar Kuandyk
cf874cee33 feat(startup): provide v:argf for file arguments #35889
Problem:
- `:args` and `argv()` can change after startup.
- `v:arg` includes options/commands, not just files.
- Plugins (e.g. Oil) may rewrite directory args.

Solution:
- New read-only var `v:argf`: snapshot of file/dir args at startup.
- Unaffected by `:args` or plugins.
- Unlike `v:argv`, excludes options/commands.
- Paths are resolved to absolute paths when possible

Example:

    nvim file1.txt dir1 file2.txt
    :echo v:argf
    " ['/home/user/project/file1.txt', '/home/user/project/dir1', '/home/user/project/file2.txt']
2026-02-25 03:38:08 -05:00
zeertzjq
6d73bf4886 vim-patch:29b5938: runtime(sshconfig): Add 3 additional keywords to syntax script (#38050)
closes: vim/vim#19488

29b5938d79

Co-authored-by: James Roberts-Thomson <jamesrt@gmail.com>
2026-02-25 08:09:09 +08:00
zeertzjq
327dcb8970 vim-patch:9.2.0046: filetype: neon files are not recoginzed (#38049)
Problem:  filetype: neon files are not recoginzed
Solution: Detect *.neon files as neon filetype
          (przepompownia)

Reference:
https://doc.nette.org/en/neon/format
https://github.com/fpob/nette.vim

closes: vim/vim#19496

ddd90672f2

Co-authored-by: przepompownia <przepompownia@users.noreply.github.com>
2026-02-25 07:53:43 +08:00
luukvbaal
844caca881 fix(ui2): multiline/color replaced message, expanded cmdline, error messages #38044
Problem:  - Unintentionally inserting lines for a replaced multiline
          message that also has multiple highlights.
          - Scheduled check to see if the expanded cmdline window was
          entered makes it difficult to keep track of what happens when
          the key pressed to dismiss it results in a message.
          - Reading the first line of an error message should be enough
          notice for something going wrong.
          - "search_cmd" messages should not be shown with 0 'cmdheight'.
          - Unable to configure dynamically changed pager height.
          - Enabling UI2 doesn't make sense with no UIs attached.

Solution: - Only insert a line for the first chunk after a newline.
          - Use getmousepos() to check if the expanded cmdline was
          clicked to enter the pager.
          entering the pager to serve as a configuration interface.
          - Don't expand the cmdline for error messages; user can press g<.
          - Don't show "search_cmd" messages with 'cmdheight' set to 0.
          - Change 'eventignorewin' to ensure WinEnter is fired when
          - Have enable() return early when no UIs are attached.
2026-02-24 17:05:38 -05:00
phanium
16aab4cb48 fix(treesitter): InspectTree only show the largest injection #37906
Problem:
:InspectTree don't show luadoc injection lua file. Since luadoc share
the same "root" with comment in their common primary (lua) tree.
Current logic simply show the largest (comment injection) and ignore all
smaller one (luadoc injection).

Solution:
Handle different lang injections separately. Then sort them by
byte_length to ensure the draw tree consistent.
2026-02-24 16:22:30 -05:00
luukvbaal
39c4e0f336 fix(messages): unwanted ext_messages newlines for confirm() #38045
Problem:  Newlines emitted with ext_messages intended to position
          the message/prompt on the message grid.
Solution: Don't emit these newlines with ext_messages, followup to 4260f73e.
2026-02-24 13:01:31 -05:00
glepnir
3115a18a80 refactor(test): lsp completion spec cleanup #38041
Problem: retry/feed/tbl_map patterns duplicated everywhere, detach check was a false negative

Solution: extract wait_for_pum/extract_word_abbr/word_sorter helpers,
fix assert_cleanup_after_detach with positive+negative pum confirmation
2026-02-24 09:20:58 -05:00
glepnir
5eb1c4df54 refactor(test): avoid deprecated functions #37017
Problem:
Tests are using some deprecated functions.

Solution:
Replace with command, pcall_err, etc.
2026-02-24 07:15:24 -05:00
github-actions[bot]
5d6846c389 docs: update version.c #37962
vim-patch:9.1.0001: tests: Test_popup_setbuf() fails
vim-patch:9.2.0018: high cpu usage with Wayland compositor
vim-patch:472f46e23 README.md: mention r/vim and #vim libera
vim-patch:dbd924f6a runtime(syntax-tests): Fail when executable syntax tests are found
vim-patch:70a9273dc Filelist: Fix CI error caused by xdg.vim missing in Filelist
vim-patch:405ba5010 runtime(doctags): remove unused header include file
vim-patch:47eb32fc9 translation(zh): Update menu translation for changed "Sponsor" entry
vim-patch:9.2.0038: Wayland: Not using bool type
vim-patch:a99dcca17 Maintainers: Update MAINTAINERS file
vim-patch:7b7a6f941 Add information for runtime files in the bug template.
vim-patch:9b16aa34b CI: Avoid referencing the unstable ddebs.ubuntu.com/noble-proposed mirror
vim-patch:9.2.0044: Wayland: still performance issues

Co-authored-by: marvim <marvim@users.noreply.github.com>
2026-02-24 03:40:03 -05:00
Oleksandr Chekhovskyi
d9d8c660fd fix(watch): invalid joined path #37973
Problem:
When vim._watch.watch() is used to watch a single file, libuv returns
the basename as the filename argument in the callback. The code joins
this with the watched path, producing a nonsensical path like
"/path/to/file.lua/file.lua", which causes ENOTDIR errors on
subsequent fs_stat calls.

Solution:
Check whether the watched path is a directory before joining the
filename. When watching a file, ignore the filename from libuv and
use the watched path directly.
2026-02-23 17:33:13 -05:00
Yochem van Rosmalen
b57ed5e940 refactor(gen): let Hugo build html docs #37972
Problem:
The html and css of the website's documentation pages are defined in
long strings in gen_help_html.lua, making it hard to maintain and
improve them. E.g. adding in headers that state the documentation is for
nightly Nvim has been a long standing feature request.

Solution:
Move the inlined css and html (e.g. the <head>, <nav>, etc.) to Hugo.

Now that the website is build with Hugo, we can use its templating
system to generate the full html/css from the Tree-sitter tree:
https://github.com/neovim/neovim.github.io/pull/437
2026-02-23 17:26:27 -05:00
Andrew Braxton
eb90f5d9e3 fix(lsp): only resolve LSP configs once (#38007)
`lsp.config[]` resolves an LSP config the first time it is called, and
returns the cached result on subsequent calls.

The change in #37571 added an extra call to `lsp.config[]` which will
resolve the config *before* the server is added to `_enabled_configs`,
meaning the result is discarded. That means configs will be needlessly
resolved again once `lsp_enable_callback` fires for the first time. That
includes an additional `loadfile()` call which is relatively expensive
and can have unexpected side effects.

Avoid this by storing the result of the initial call to `lsp.config[]`
in `_enabled_configs` so the config is not resolved a second time once
`lsp_enable_callback` is called for the first time.
2026-02-23 11:15:53 -08:00
bfredl
4d754d2704 Merge pull request #37265 from bfredl/zigluajit
fix(build): build.zig: use luajit also on windows
2026-02-23 18:43:28 +01:00
glepnir
1ec74fa7b1 fix(api): win_config border type #38030
Problem: ArrayOf(String) doesn't cover mixed string/array border chars.

Solution: use Union(Array, Enum(...)) to match parse_border_style behavior.
2026-02-23 11:23:46 -05:00
Sean Dewar
32d3dd0650 fix(statusline): broken statusline on error #38000
Problem: after #33036, an error from evaluating 'statusline' clears it and
doesn't draw the statusline. (causing glitchy redraws)

Solution: use the default value instead. If 'stl' is somehow ever empty, still
call redraw_custom_statusline to at least draw an empty statusline.

Ideally our default 'stl' shouldn't itself error too! :-)
Also adjust some prior screen:expect()s to avoid immediate success warnings.
2026-02-23 11:22:13 -05:00
Sean Dewar
2478a7fbbd docs(api): nvim_open_win "split" with negative "win" #38032
Acts like :topleft/botright.
2026-02-23 10:10:20 -05:00
GX
374e869504 build: distclean: remove zig-related dirs #38013 2026-02-23 14:56:41 +00:00
Justin M. Keyes
0d13945bbb feat(messages): drop hardcoded 'showmode' delay #38029
Problem:
- Editing a 'readonly' file forces a 3-second delay.
- nvim_get_mode waits 3 secs with 'showmode' enabled or when there are error messages.

Solution:
Remove the delay for "ui2", by using `msg_delay`.
2026-02-23 09:54:35 -05:00
zeertzjq
f1490b5fe9 test: don't test overriding argv[0] using FFI (#38012)
Instead, test this by adding a new functionality to shell-test, allowing
reuse in other future tests.
2026-02-23 21:43:44 +08:00
bfredl
8069df2661 fix(build): build.zig: use luajit for windows
These were disabled as they failed when tested with cross-compiling,
but it works fine for windows natively on ci, so let's use that.

mac os builds after disabling debug info, which currently
triggers a bug in zig's MachO linker: natecraddock/ziglua#191
Tracking issue: https://codeberg.org/ziglang/zig/issues/30669
Unfortunately actually using the JIT of luajit still triggers
issues on mac os, so we cannot use it yet.

Also sync luajit version used via ziglua to a recent one
like we use in cmake, see natecraddock/ziglua#196
2026-02-23 10:33:06 +01:00
Sathya Pramodh
c5b8ed870b fix(coverity/644326): NULL ptr deref in socket_address_is_tcp #38010 2026-02-23 04:18:20 -05:00
Justin M. Keyes
ce5c7111f4 refactor: defer_fn return type #37999 2026-02-23 03:24:14 -05:00
Justin M. Keyes
61678811d8 fix(health): check more "old" files #38028 2026-02-23 03:20:37 -05:00
zeertzjq
250d77cce7 test(terminal/scrollback_spec): fix flaky test (#38026)
When using feed_data() with hidden buffer, terminal refresh may arrive
during may_restore_curbuf(), causing "last cursor" positions to change.
Get the two "last cursor" positions in the same RPC call.
2026-02-23 13:51:37 +08:00
zeertzjq
97509aa2be fix(process): handle poll() interrupted by a signal (#38024)
It is indeed possible that a signal may arrive during flush_stream()
(e.g. SIGCHLD from another child process), so poll() again on EINTR.

Fixes the following Coverity warning:
_____________________________________________________________________________________________
*** CID 644345:         Error handling issues  (CHECKED_RETURN)
/src/nvim/event/proc.c: 405             in flush_stream()
399
400     #ifdef __linux__
401         // On Linux, libuv's polling (which uses epoll) doesn't flush PTY master's pending
402         // work on kernel workqueue, so use an explcit poll() before that. #37982
403         if (proc->type == kProcTypePty && !stream->did_eof) {
404           struct pollfd pollfd = { .fd = ((PtyProc *)proc)->tty_fd, .events = POLLIN };
>>>     CID 644345:         Error handling issues  (CHECKED_RETURN)
>>>     Calling "poll(&pollfd, 1UL, 0)" without checking return value. This library function may fail and return an error code.
405           poll(&pollfd, 1, 0);
406         }
407     #endif
408         // Poll for data and process the generated events.
409         loop_poll_events(proc->loop, 0);
410         if (stream->s.events) {

Another possible error is ENOMEM, which is probably not worth handling.
For reference, #23308 previously removed a case of ENOMEM handling, and
this PR also removes an outdated mention of that.

Also reduce the number of #ifdefs in non-OS-specific files.
2026-02-23 12:28:17 +08:00
zeertzjq
ec24746406 test(core/channels_spec): fix flaky test (#38025)
If the last nvim_eval arrives on RPC channel before rpc_close_event() is
processed, it will be scheduled immediately after rpc_close_event() and
before free_channel_event(), causing the test to fail.
2026-02-23 04:26:38 +00:00
zeertzjq
1b013adff3 test(terminal/channel_spec): fix flaky test (#38023)
Adding input doesn't help here, as the important part here is processing
main_loop.events, not running the main loop. Instead, use a non-fast API
request to ensure that previously queued events are processed.
2026-02-23 01:48:15 +00:00
zeertzjq
14fe370564 fix(logging): don't overwrite NameBuff (#38004) 2026-02-23 08:00:26 +08:00
zeertzjq
8a4719e117 fix(process): use poll() to drain PTY master on Linux (#38005)
On Linux, libuv's polling (which uses epoll) doesn't flush PTY master's
pending work on kernel workqueue, so use an explicit poll() before that.
2026-02-23 07:15:38 +08:00
glepnir
f90cd620c5 fix(lsp): vim.lsp.completion clean up triggers on client detach (#38009)
Problem: LspDetach didn't clean up stale client refs in triggers table.

Solution: create LspDetach autocmd and call disable_completion.
2026-02-22 11:43:32 -08:00
zeertzjq
3f4ef487da vim-patch:9.2.0040: completion: preinsert wrong with register completion (#38003)
Problem:  completion: preinsert wrong with register completion
Solution: Remove preinserted text during register content insertion
          (Girish Palya).

fixes:  vim/vim#19329
closes: vim/vim#19474

3684ad83d1

Co-authored-by: Girish Palya <girishji@gmail.com>
2026-02-22 08:13:15 +08:00
zeertzjq
940d5c239b Merge pull request #37991 from zeertzjq/vim-9.2.0031
vim-patch:9.2.{0031,0041}: Inefficient use of ga_concat()
2026-02-22 07:43:59 +08:00
zeertzjq
b775c722dd vim-patch:9.2.0041: Not always using GA_CONCAT_LITERAL
Problem:  Not always using GA_CONCAT_LITERAL with string literals.
          (after: v9.2.0031)
Solution: Use the GA_CONCAT_LITERAL, instead of ga_concat_len.
          (John Marriott)

closes: vim/vim#19468

fc90d8087a

Co-authored-by: John Marriott <basilisk@internode.on.net>
2026-02-22 07:10:58 +08:00
zeertzjq
b3a3028fd9 vim-patch:9.2.0031: Inefficient use of ga_concat()
Problem:  Inefficient use of ga_concat()
Solution: Use ga_concat_len() when the length is already known to avoid
          use of strlen() (John Marriott).

closes: vim/vim#19422

ed202035b1

Co-authored-by: John Marriott <basilisk@internode.on.net>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2026-02-22 07:02:47 +08:00
wjyoung65
9aa936d892 test(ui): failure in lua/ui_spec.lua in headless OS (no GUI) #37975 2026-02-21 15:00:06 -05:00
Justin M. Keyes
4648d89d50 docs: highlight, terminal SGR #37998 2026-02-21 14:52:13 -05:00
luukvbaal
96957d80c6 fix(messages): reinstate 'showmode' message delay #37992
Problem:  94c21c2 erroneously removed message delay without ext_messages.
Solution: Remove delay with ext_messages as intended.
2026-02-21 14:13:24 -05:00
Riley Bruins
524164ae05 ci: lint and format treesitter queries
This also adds a `formatquery` rule to write the new format to the query
files.
2026-02-21 13:26:36 +01:00
zeertzjq
30d9970cd7 vim-patch:9.2.0036: completion: thesaurus completion incorrect with "longest/fuzzy" (#37996)
Problem:  completion: thesaurus completion incorrect with
          "longest/fuzzy" (Mao-Yining)
Solution: Disable fuzzy matching and longest-match insertion
          specifically for thesaurus completion (Girish Palya).

fixes:  vim/vim#19356
closes: vim/vim#19475

26a3f486cc

Co-authored-by: Girish Palya <girishji@gmail.com>
2026-02-21 19:54:25 +08:00
Sathya Pramodh
d79a9dcd42 refactor(net): socket_address_is_tcp #37947 2026-02-20 18:41:55 -05:00
Riccardo Mazzarini
cb8c9186e6 feat(highlight): support more SGR attributes #37901
Problem:
TUI does not support several standard SGR text attributes:
- dim/faint (SGR 2)
- blink (SGR 5)
- conceal (SGR 8)
- overline (SGR 53)
This means that when a program running in the embedded terminal emits
one of these escape codes, we drop it and don't surface it to the
outer terminal.

Solution:
- Add support for those attributes.
- Also add corresponding flags to `nvim_set_hl` opts, so users can set
  these attributes in highlight groups.
  - refactor(highlight): widen `HlAttrFlags` from `int16_t` to `int32_t`
    Widen the `rgb_ae_attr` and `cterm_ae_attr` fields in HlAttrs from
    int16_t to int32_t to make room for new highlight attribute flags,
    since there was only one spare bit left.
  - The C flag is named HL_CONCEALED to avoid colliding with the
    existing HL_CONCEAL in syntax.h (which is a syntax group flag, not
    an SGR attribute).
- Also note that libvterm doesn't currently support the dim and overline
  attributes, so e.g. `printf '\e[2mThis should be dim\n'` and `printf
  '\e[53mThis should have an overline\n'` are still not rendered
  correctly when run from the embedded terminal.
2026-02-20 18:35:55 -05:00
zeertzjq
57c6b61cf2 fix(event-loop): don't call uv_stop() when loop isn't running (#37984)
Otherwise it will cause the next uv_run() to stop immediately.
2026-02-21 05:50:54 +08:00