Commit Graph

35926 Commits

Author SHA1 Message Date
Justin M. Keyes
d9d3822a7b docs: misc #38532
Close #38431
Close #38521
Close #38530

Co-authored-by: tayheau <thopsore@pasteur.fr>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Olivia Kinnear <git@superatomic.dev>
2026-03-29 11:56:37 -04:00
zeertzjq
7d97de27cf Merge pull request #38559 from zeertzjq/vim-9.2.0270
vim-patch:9.2.{0050,0270}
2026-03-29 23:29:57 +08:00
Luis Calle
f3c2eb49ba feat: extend vim.Pos, vim.Range #36397
Problem:
Using nested `vim.Pos` objects to represent each `vim.Range` object
requires 3 tables for each `vim.Range`, which may be undesirable in
performance critical code. Using key-value tables performs worse than
using array-like tables (lists).

Solution:
Use array-like indices for the internal fields of both `vim.Pos` and
`vim.Range` objects. Use a metatable to allow users to access them like
if they were key-value tables.

---

Problem:
The `vim.Pos` conversion interface for `extmark` indexing does not take
into account the difference in how a position on top of a newline is
represented in `vim.Pos` and `extmark`.
- `vim.Pos`: for a newline at the end of row `n`, `row` takes the value
  `n + 1` and `col` takes the value `0`.
- `extmark`: for a newline at the end of for `n`, `row` takes the value
  `n` and `col` takes the value `#row_text`.

Solution:
Handle this in the `extmark` interface.

---

Problem:
Not all `to_xxx` interfaces have wrapping objects like `to_lsp`.

Solution:
Return unwrapped values in `to_xxx` interfaces where it makes sense.
Accept unwrapped values in "from" interfaces where it makes sense.

---

Problem:
`start` and `end` positions have different semantics, so they can't be
compared. `vim.Range` relies on comparing the `end` and `start` of two
ranges to decide which one is greater, which doesn't work as expected
because this of the different semantics.

For example, for the ranges:

    local a = {
      start = { row = 0, col = 22, },
      end_ = { row = 0, col = 24, },
    }
    local b = {
      start = { row = 0, col = 17, },
      end_ = { row = 0, col = 22, },
    }

in this code:

    local foo, bar = "foo",  "bar"
    --               |---||-|
    --                 b  a

The range `b` is smaller than the range `a`, but the current
implementation compares `b._end` (`col = 22`) and `a.start` (`col = 22`)
and concludes that, since `b.col` is not smaller than `a.col`, `b`
should be greater than `a`.

Solution:
- Use a `to_inclusive_pos` to normalize end positions inside of
  `vim.Range` whenever a comparison between a start and an end position
  is necessary.
2026-03-29 11:22:40 -04:00
zeertzjq
ba89354a45 vim-patch:9.2.0270: test: trailing spaces used in tests
Problem:  test: trailing spaces used in tests
Solution: Rewrite tests to avoid trailing spaces (Paul Ollis).

Some tests currently rely on trailing whitespace at the end of lines,
escaped with '\'. I have demonstrated in another PR, such spaces can be
inadvertently removed and this is difficult to spot.

Note: there are more trailing spaces in a few more test files, see
testdir/test_codestyle.vim. Those are not yet removed.

closes: vim/vim#19838

211ceea602

Co-authored-by: Paul Ollis <paul@cleversheep.org>
2026-03-29 22:30:41 +08:00
zeertzjq
a89b9750ee vim-patch:9.2.0050: WM_SETFOCUS not handled immediately
Problem:  In gvim on Windows, a certain problem can occur when the
          WM_SETFOCUS event sent after an external command is not
          processed immediately.
Solution: After posting WM_SETFOCUS, run the message loop to process it
          as quickly as possible (Muraoka Taro).

The problem is that Test_normal11_showcmd may fail when running the
test_normal.vim test.  Investigation revealed that the trigger was an
external command executed in the previous test,
Test_mouse_shape_after_failed_change, when two tests were executed
consecutively.  In gvim on Windows, a WM_SETFOCUS event will be sent
when an external command finishes executing.  This WM_SETFOCUS event is
not processed immediately, but rather by redraw, which is expected to
update showcmd. Because it is queued in typebuf at this time,
clear_showcmd(), which expects typebuf to be empty, cannot update
showcmd.

Also added a test that simulates the above problem.

closes: vim/vim#19167

c4a6fa3ead

Co-authored-by: Muraoka Taro <koron.kaoriya@gmail.com>
2026-03-29 22:30:24 +08:00
Justin M. Keyes
527684c8dd Merge #38542 fix/skip s390x failures 2026-03-29 09:10:00 -04:00
Justin M. Keyes
9c55674ba9 test(oldtest): skip 2 tests on s390x
Failures:
    From test_plugin_tar.vim:
    Found errors in Test_tar_evil():
    command line..script …/test/old/testdir/runtest.vim[659]..function RunTheTest[61]..Test_tar_evil line 12: Pattern '/etc/ax-pwn' does not match '/usr/bin/tar: Removing leading `/'' from member names'
    Caught exception in Test_tar_evil(): Vim(read):E484: Can't open file usr/bin/tar: Removing leading `/' from member names @ command line..script …/test/old/testdir/runtest.vim[659]..function
    RunTheTest[61]..Test_tar_evil[22]..<SNR>10_TarBrowseSelect[27]..tar#Read, line 114
    Found errors in Test_tar_path_traversal_with_nowrapscan():
    command line..script …/test/old/testdir/runtest.vim[659]..function RunTheTest[61]..Test_tar_path_traversal_with_nowrapscan[1]..<SNR>8_CopyFile line 2: Can't copy samples/evil.tar
    command line..script …/test/old/testdir/runtest.vim[659]..function RunTheTest[61]..Test_tar_path_traversal_with_nowrapscan line 14: Pattern '/etc/ax-pwn' does not match '/usr/bin/tar: Removing leading `/'' from
    member names'
    From test_search_stat.vim:
    Found errors in Test_search_stat_option():
    Run 1, 00:17:24 - 00:17:26 in  2.405525 seconds:
    command line..script …/test/old/testdir/runtest.vim[659]..function RunTheTest[61]..Test_search_stat_option line 31: Pattern 'fo\\*\\\\(bar\\\\?\\\\)\\\\?\\s\\+\\[2/>999\\]' does not match '\n/fo*\\(bar\\?\\)\\?\[
    occurs 63 times]\n\n/fo*\\(bar\\?\\)\\?\[  occurs 57 times][?/??]'
    command line..script …/test/old/testdir/runtest.vim[659]..function RunTheTest[61]..Test_search_stat_option line 32: Expected {'incomplete': 2, 'total': 1000} but got {'incomplete': 1, 'total': 980} - 3 equal items
    omitted
    command line..script …/test/old/testdir/runtest.vim[659]..function RunTheTest[61]..Test_search_stat_option line 52: Expected {'exact_match': 1, 'current': 27992, 'incomplete': 0, 'total': 28000} but got
    {'exact_match': 0, 'current': 18044, 'incomplete': 1, 'total': 18044} - 1 equal item omitted
    command line..script …/test/old/testdir/runtest.vim[659]..function RunTheTest[61]..Test_search_stat_option line 55: Expected {'incomplete': 0, 'total': 28000} but got {'incomplete': 1, 'total': 18143} - 3 equal
    items omitted
    command line..script …/test/old/testdir/runtest.vim[659]..function RunTheTest[61]..Test_search_stat_option line 65: Expected {'total': 28000, 'incomplete': 0} but got {'total': 18168, 'incomplete': 1} - 3 equal
    items omitted
    command line..script …/test/old/testdir/runtest.vim[659]..function RunTheTest[61]..Test_search_stat_option line 68: Expected {'exact_match': 1, 'current': 27991, 'total': 28000, 'incomplete': 0} but got
    {'exact_match': 0, 'current': 18167, 'total': 18167, 'incomplete': 1} - 1 equal item omitted
    Run 2, 00:17:28 - 00:17:32 in  3.437275 seconds:
    command line..script …/test/old/testdir/runtest.vim[700]..function RunTheTest[61]..Test_search_stat_option line 31: Pattern 'fo\\*\\\\(bar\\\\?\\\\)\\\\?\\s\\+\\[2/>999\\]' does not match '\n/fo*\\(bar\\?\\)\\?\[
    occurs 63 times]\n\n/fo*\\(bar\\?\\)\\?\[  occurs 57 times][?/??]'
    command line..script …/test/old/testdir/runtest.vim[700]..function RunTheTest[61]..Test_search_stat_option line 32: Expected {'incomplete': 2, 'total': 1000} but got {'incomplete': 1, 'total': 991} - 3 equal items
    omitted
    Run 3, 00:17:36 - 00:17:39 in  3.408885 seconds:
    command line..script …/test/old/testdir/runtest.vim[700]..function RunTheTest[61]..Test_search_stat_option line 31: Pattern 'fo\\*\\\\(bar\\\\?\\\\)\\\\?\\s\\+\\[2/>999\\]' does not match '\n/fo*\\(bar\\?\\)\\?\[
    occurs 63 times]\n\n/fo*\\(bar\\?\\)\\?\[  occurs 57 times][?/??]'
    command line..script …/test/old/testdir/runtest.vim[700]..function RunTheTest[61]..Test_search_stat_option line 32: Expected {'incomplete': 2, 'total': 1000} but got {'incomplete': 1, 'total': 994} - 3 equal items
    omitted
    Flaky test failed too often, giving up
2026-03-29 13:36:56 +02:00
Justin M. Keyes
0ac321a1d6 test: fix s390x failures
Problem:
failures in s390x CI.

Solution:
- runtime/lua/man.lua: parse_path() can return nil but 3 callers didn't handle it.
- skip some tests on s390x.

TODO:

- TODO: why "build/bin/xxd is not executable" on s390x?
- TODO: other failures, not addressed (see below).

OTHER FAILURES:

    FAILED   test/functional/treesitter/fold_spec.lua @ 87: treesitter foldexpr recomputes fold levels after lines are added/removed
    test/functional/treesitter/fold_spec.lua:95: Expected objects to be the same.
    Passed in:
    (table: 0x4013c18940) {
      [1] = '0'
      [2] = '0'
      [3] = '0'
     *[4] = '0'
      [5] = '0'
      ...
    Expected:
    (table: 0x4005acf900) {
      [1] = '0'
      [2] = '0'
      [3] = '>1'
     *[4] = '1'
      [5] = '1'
      ...

    stack traceback:
            (tail call): ?
            test/functional/treesitter/fold_spec.lua:95: in function <test/functional/treesitter/fold_spec.lua:87>

    FAILED   test/functional/treesitter/select_spec.lua @ 52: treesitter incremental-selection works
    test/functional/treesitter/select_spec.lua:63: Expected objects to be the same.
    Passed in:
    (string) 'bar(2)'
    Expected:
    (string) 'foo(1)'

    stack traceback:
            (tail call): ?
            test/functional/treesitter/select_spec.lua:63: in function <test/functional/treesitter/select_spec.lua:52>

    FAILED   test/functional/treesitter/select_spec.lua @ 69: treesitter incremental-selection repeat
    test/functional/treesitter/select_spec.lua:82: Expected objects to be the same.
    Passed in:
    (string) '2'
    Expected:
    (string) '4'

    stack traceback:
            (tail call): ?
            test/functional/treesitter/select_spec.lua:82: in function <test/functional/treesitter/select_spec.lua:69>

    FAILED   test/functional/treesitter/select_spec.lua @ 98: treesitter incremental-selection history
    test/functional/treesitter/select_spec.lua:111: Expected objects to be the same.
    Passed in:
    (string) 'bar(2)'
    Expected:
    (string) 'foo(1)'

    stack traceback:
            (tail call): ?
            test/functional/treesitter/select_spec.lua:111: in function <test/functional/treesitter/select_spec.lua:98>

    FAILED   test/functional/treesitter/select_spec.lua @ 186: treesitter incremental-selection with injections works
    test/functional/treesitter/select_spec.lua:201: Expected objects to be the same.
    Passed in:
    (string) 'lua'
    Expected:
    (string) 'foo'

    stack traceback:
            (tail call): ?
            test/functional/treesitter/select_spec.lua:201: in function <test/functional/treesitter/select_spec.lua:186>

    FAILED   test/functional/treesitter/select_spec.lua @ 216: treesitter incremental-selection with injections ignores overlapping nodes
    test/functional/treesitter/select_spec.lua:231: Expected objects to be the same.
    Passed in:
    (string) ' )'
    Expected:
    (string) ' foo('

    stack traceback:
            (tail call): ?
            test/functional/treesitter/select_spec.lua:231: in function <test/functional/treesitter/select_spec.lua:216>

    FAILED   test/functional/treesitter/select_spec.lua @ 307: treesitter incremental-selection with injections handles disjointed trees
    test/functional/treesitter/select_spec.lua:337: Expected objects to be the same.
    Passed in:
    (string) 'int'
    Expected:
    (string) '1}'

    stack traceback:
            (tail call): ?
            test/functional/treesitter/select_spec.lua:337: in function <test/functional/treesitter/select_spec.lua:307>

    ERROR    test/functional/treesitter/parser_spec.lua @ 562: treesitter parser API can run async parses with string parsers
    test/functional/treesitter/parser_spec.lua:565: attempt to index a nil value

    stack traceback:
            test/functional/testnvim/exec_lua.lua:124: in function <test/functional/testnvim/exec_lua.lua:105>
            (tail call): ?
            (tail call): ?
            test/functional/treesitter/parser_spec.lua:563: in function <test/functional/treesitter/parser_spec.lua:562>

    FAILED   test/functional/core/job_spec.lua @ 1157: jobs jobstop() kills entire process tree #6530
    test/functional/core/job_spec.lua:1244: retry() attempts: 94
    test/functional/core/job_spec.lua:1246: Expected objects to be the same.
    Passed in:
    (table: 0x401dd74b30) {
      [name] = 'sleep <defunct>'
      [pid] = 33579
      [ppid] = 1 }
    Expected:
    (userdata) 'vim.NIL'

    stack traceback:
            test/testutil.lua:89: in function 'retry'
            test/functional/core/job_spec.lua:1244: in function <test/functional/core/job_spec.lua:1157>
2026-03-29 13:36:56 +02:00
zeertzjq
79ebe54634 refactor(ui_client.c): remove unused variable (#38552)
It's been unused since #36319.
2026-03-29 11:24:52 +00:00
Justin M. Keyes
7cd22e916b fix(:connect): formalize connect event #38543
Also document it.
2026-03-29 06:59:34 -04:00
zeertzjq
44a88a746f fix(:restart): specify ++nested in UIEnter (#38550) 2026-03-29 09:04:15 +00:00
zeertzjq
ad4bc2d90c refactor(:restart): execute [command] on UIEnter (#38541)
This avoids having to pass it in the UI event.
2026-03-29 08:12:32 +08:00
Justin M. Keyes
bff9b5f010 refactor: move ugrid.c => tui/ugrid.c #38540
This module is only used by the tui code.
2026-03-28 20:05:53 -04:00
Sathya Pramodh
d5516daf12 fix(:restart): formalize restart event #35223
Problem:
The "restart" event has some problems:
- all UI clients must implement a somewhat complex set of setups
- UI must be on the same machine as the server
- only works for the "current" UI
- race/edge case: If the user config has errors / waiting for input, are
  all UIs able to attach while Nvim is waiting for input?

Solution:
- Perform the restart on the server, not the client.
- Pass listen address (instead of CLI args) in the UI event.
- Simplifies UI logic: they only need to attach to new address.
- Opens the door for more enhancements in the future, such as allowing
  all UIs to reattach instead of only the "current" UI.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-03-28 15:25:09 -04:00
Justin M. Keyes
64d55b74d8 docs: news #38464 2026-03-28 09:59:54 -04:00
Shadman
7bf83cc2a6 fix(progress): require "source" for progress-message #38514
Problem:
- Progress-events are filtered by "source". But "source" is not required by nvim_echo.
- Without "++nested" (force=false), nvim_echo in an event-handler does not trigger Progress events.
- vim.health does not declare a "source".

Solution:
- Make source mandatory for progress-messages
- Enable ++nested (force=true) by default when firing Progress event.
- Set "source" in vim.health module.
2026-03-28 09:22:22 -04:00
zeertzjq
5a7df03b42 vim-patch:9.2.0265: unnecessary restrictions for defining dictionary function names (#38524)
Problem:  unnecessary restrictions for defining dictionary function
          names
Solution: Allow defining dict function with bracket key that is not a
          valid identifier (thinca)

In Vim script, "function obj.func()" and "function obj['func']()" both
define a dictionary function.  However, the bracket form required the
key to match function naming rules (eval_isnamec), so
"function obj['foo-bar']()" failed with E475.

Assigning and calling already work: "let obj['foo-bar'] = obj.func"
and "call obj['foo-bar']()" are valid.  Only the definition was
incorrectly restricted.

Skip the identifier check when the name comes from fd_newkey (i.e. the
key was given in bracket notation).  Dictionary keys may be any string.

Supported by AI

closes: vim/vim#19833

f89662722d

Co-authored-by: thinca <thinca@gmail.com>
2026-03-28 18:51:00 +08:00
glepnir
9383a096eb fix(api): nvim_set_hl boolean false corrupts underline styles (#38504)
Problem: setting one underline style to false clears bits belonging
to another style. `{underdouble = true, underdashed = false}` results
in undercurl because CHECK_FLAG_WITH_KEY does `m &= ~flag` which
doesn't work for multi-bit encoded values sharing HL_UNDERLINE_MASK.

Solution: use a local variable to derive the correct clear mask from
the flag. Clear the whole HL_UNDERLINE_MASK field instead of individual
bits, and only clear on false when the current style actually matches.
2026-03-28 15:26:46 +08:00
Christian Clason
f027f41e2c build(deps): bump luajit to fbb36bb6b 2026-03-27 23:58:50 +01:00
Maria Solano
9c5d8b475e docs(lsp): add init_options to Copilot example #38502
Problem:
When following this example from our docs the Copilot LSP won't attach.

Solution:
Add `init_options` as done by [`nvim-lspconfig`](1a6d692067/lsp/copilot.lua (L112-L121)).
2026-03-27 12:33:31 -04:00
zeertzjq
9287c73df9 fix(:connect): don't use freed memory (#38512)
Changing REUSE_MAX from 4 to 0 produces the following ASAN error:

=================================================================
==924403==ERROR: AddressSanitizer: heap-use-after-free on address 0x7d33333ed128 at pc 0x55f165a47a86 bp 0x7fff40e71690 sp 0x7fff40e71688
READ of size 1 at 0x7d33333ed128 thread T0
    #0 0x55f165a47a85 in socket_address_tcp_host_end **/src/nvim/event/socket.c:37:30
    #1 0x55f1667d6349 in channel_connect_event **/src/nvim/ui_client.c:296:17
    #2 0x55f165a35af6 in multiqueue_process_events **/src/nvim/event/multiqueue.c:159:7
    #3 0x55f165a308f6 in loop_poll_events **/src/nvim/event/loop.c:81:3
    #4 0x55f1667d3fbc in ui_client_run **/src/nvim/ui_client.c:172:5
    #5 0x55f165e1f2e1 in main **/src/nvim/main.c:367:5
    #6 0x7f23340bc6c0 in __libc_start_call_main /usr/src/debug/glibc/glibc/csu/../sysdeps/nptl/libc_start_call_main.h:59:16
    #7 0x7f23340bc7f8 in __libc_start_main /usr/src/debug/glibc/glibc/csu/../csu/libc-start.c:360:3
    #8 0x55f16521d044 in _start (**/build/bin/nvim+0xcb9044) (BuildId: 6c8517919bbcd317c6bb5675d1eb3f2c7c319e2c)

0x7d33333ed128 is located 40 bytes inside of 4096-byte region [0x7d33333ed100,0x7d33333ee100)
freed by thread T0 here:
    #0 0x55f16532547d in free.part.0 asan_malloc_linux.cpp.o
    #1 0x55f165fc2380 in xfree **/src/nvim/memory.c:159:3
    #2 0x55f165fc5b6d in free_block **/src/nvim/memory.c:786:5
    #3 0x55f165fc5c38 in arena_mem_free **/src/nvim/memory.c:798:5
    #4 0x55f166082dd2 in parse_msgpack **/src/nvim/msgpack_rpc/channel.c:258:7
    #5 0x55f166078ade in receive_msgpack **/src/nvim/msgpack_rpc/channel.c:217:5
    #6 0x55f165a4683b in read_event **/src/nvim/event/rstream.c:234:23
    #7 0x55f165a462d8 in invoke_read_cb **/src/nvim/event/rstream.c:287:3
    #8 0x55f165a42e11 in read_cb **/src/nvim/event/rstream.c:149:3
    #9 0x55f166bdc28b in uv__read **/.deps/build/src/libuv/src/unix/stream.c:1145:7
    #10 0x55f166bdba97 in uv__stream_io **/.deps/build/src/libuv/src/unix/stream.c:1208:5
    #11 0x55f166bca7fe in uv__io_cb **/.deps/build/src/libuv/src/unix/core.c:930:5
    #12 0x55f166be6251 in uv__io_poll **/.deps/build/src/libuv/src/unix/linux.c:1546:11
    #13 0x55f166bc9c57 in uv_run **/.deps/build/src/libuv/src/unix/core.c:460:5
    #14 0x55f165a30be7 in loop_uv_run **/src/nvim/event/loop.c:59:3
    #15 0x55f165a30864 in loop_poll_events **/src/nvim/event/loop.c:80:26
    #16 0x55f1667d3fbc in ui_client_run **/src/nvim/ui_client.c:172:5
    #17 0x55f165e1f2e1 in main **/src/nvim/main.c:367:5
    #18 0x7f23340bc6c0 in __libc_start_call_main /usr/src/debug/glibc/glibc/csu/../sysdeps/nptl/libc_start_call_main.h:59:16
    #19 0x7f23340bc7f8 in __libc_start_main /usr/src/debug/glibc/glibc/csu/../csu/libc-start.c:360:3
    #20 0x55f16521d044 in _start (**/build/bin/nvim+0xcb9044) (BuildId: 6c8517919bbcd317c6bb5675d1eb3f2c7c319e2c)

previously allocated by thread T0 here:
    #0 0x55f1653263e5 in malloc (**/build/bin/nvim+0xdc23e5) (BuildId: 6c8517919bbcd317c6bb5675d1eb3f2c7c319e2c)
    #1 0x55f165fc2054 in try_malloc **/src/nvim/memory.c:113:15
    #2 0x55f165fc22b4 in xmalloc **/src/nvim/memory.c:147:15
    #3 0x55f165fc4d5d in alloc_block **/src/nvim/memory.c:717:12
    #4 0x55f165fc4e09 in arena_alloc_block **/src/nvim/memory.c:724:20
    #5 0x55f165fc5113 in arena_alloc **/src/nvim/memory.c:746:5
    #6 0x55f166096d98 in api_parse_enter **/src/nvim/msgpack_rpc/unpacker.c:161:5
    #7 0x55f166aa290e in mpack_parse_tok **/src/mpack/object.c:56:29
    #8 0x55f166aa4fa9 in mpack_parse **/src/mpack/object.c:82:16
    #9 0x55f166099de9 in unpacker_advance **/src/nvim/msgpack_rpc/unpacker.c:343:12
    #10 0x55f1660825c9 in parse_msgpack **/src/nvim/msgpack_rpc/channel.c:248:10
    #11 0x55f166078ade in receive_msgpack **/src/nvim/msgpack_rpc/channel.c:217:5
    #12 0x55f165a4683b in read_event **/src/nvim/event/rstream.c:234:23
    #13 0x55f165a462d8 in invoke_read_cb **/src/nvim/event/rstream.c:287:3
    #14 0x55f165a42e11 in read_cb **/src/nvim/event/rstream.c:149:3
    #15 0x55f166bdc28b in uv__read **/.deps/build/src/libuv/src/unix/stream.c:1145:7
    #16 0x55f166bdba97 in uv__stream_io **/.deps/build/src/libuv/src/unix/stream.c:1208:5
    #17 0x55f166bca7fe in uv__io_cb **/.deps/build/src/libuv/src/unix/core.c:930:5
    #18 0x55f166be6251 in uv__io_poll **/.deps/build/src/libuv/src/unix/linux.c:1546:11
    #19 0x55f166bc9c57 in uv_run **/.deps/build/src/libuv/src/unix/core.c:460:5
    #20 0x55f165a30be7 in loop_uv_run **/src/nvim/event/loop.c:59:3
    #21 0x55f165a30864 in loop_poll_events **/src/nvim/event/loop.c:80:26
    #22 0x55f1667d3fbc in ui_client_run **/src/nvim/ui_client.c:172:5
    #23 0x55f165e1f2e1 in main **/src/nvim/main.c:367:5
    #24 0x7f23340bc6c0 in __libc_start_call_main /usr/src/debug/glibc/glibc/csu/../sysdeps/nptl/libc_start_call_main.h:59:16
    #25 0x7f23340bc7f8 in __libc_start_main /usr/src/debug/glibc/glibc/csu/../csu/libc-start.c:360:3
    #26 0x55f16521d044 in _start (**/build/bin/nvim+0xcb9044) (BuildId: 6c8517919bbcd317c6bb5675d1eb3f2c7c319e2c)

SUMMARY: AddressSanitizer: heap-use-after-free **/src/nvim/event/socket.c:37:30 in socket_address_tcp_host_end
Shadow bytes around the buggy address:
  0x7d33333ece80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x7d33333ecf00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x7d33333ecf80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x7d33333ed000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x7d33333ed080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x7d33333ed100: fd fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd
  0x7d33333ed180: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x7d33333ed200: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x7d33333ed280: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x7d33333ed300: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x7d33333ed380: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==924403==ABORTING
2026-03-27 22:32:06 +08:00
Shadman
a940b77cb2 feat(prompt): prompt_appendbuf() appends to prompt buffer #37763
Problem:
Currently, we recommend always inserting text above prompt-line in
prompt-buffer. This can be done using the `:` mark. However, although
we recommend it this way it can sometimes get confusing how to do it
best.

Solution:
Provide an api to append text to prompt buffer. This is a common
use-case for things using prompt-buffer.
2026-03-27 07:39:09 -04:00
Evgeni Chasnovski
0fa96585dc fix(pack): set source in progress report #38511
Problem: Progress reports via `nvim_echo()` gained an ability to set
  `source` and `vim.pack` doesn't currently set one.

Solution: Set `source` to 'vim.pack'. Ideally, the title then can be
  something else more informative (like "update", "download", etc.), but
  it is used when showing progress messages. So it has to be "vim.pack"
  in this case.
2026-03-27 07:36:06 -04:00
kq
3898f34c5a fix(messages): spurious newline with --headless + cmdheight=0 #38494
Problem:
When running nvim in headless mode with `cmdheight=0`, an extra newline
is prepended to output (eg. `nvim --clean --cmd 'set cmdheight=0'
--headless -c 'echo 1 | q' ` prints `\n1` instead of `1`), because
`!ui_has(kUIMessages)` is always true in headless mode, causing `p_ch ==
0` in `msg_start()` to unconditionally trigger `msg_putchar('\n')` which
writes a newline to stdout.

Solution:
When in headless printf mode with `p_ch == 0` and no prior output on the
current line, call `msg_puts_display("\n", ...)` directly instead of
`msg_putchar('\n')`, so the grid is still updated for correct screen
positioning but no newline is written to stdout.
2026-03-27 07:08:32 -04:00
Shadman
4b643d7068 feat(progress): set Progress-event pattern to "source" #38495
Problem:
Currently, there's no way to distinguish progress messages coming from
different sources. Nor can Progress event be easily filtered based on
source.

Solution:
- Add "source" field to nvim_echo-opts.
- The Progress event pattern is now defined by the "source" field.
- Include the "title" as ev.data.
- Unrelated change: set force=false to disable nesting.
2026-03-27 06:24:14 -04:00
zeertzjq
925e9e8722 vim-patch:c84526d: runtime(amiga): revamp syntax highlighting and add new maintainer (#38503)
closes: vim/vim#19825

c84526dd29

Co-authored-by: Ola Söder <rolfkopman@gmail.com>
2026-03-27 09:17:47 +08:00
phanium
ae2829ee35 fix(ui2): ENTER may focus pager in insert/terminal mode #38497
fix(ui2): prevent <CR> from focusing pager in insert/terminal mode

Problem:  <CR> in insert/terminal mode can focus pager unexpectedly.
Solution: Don't enter the pager when <CR> is pressed during expanded
          cmdline in insert/terminal mode.
2026-03-26 13:42:46 -04:00
dependabot[bot]
5f9bc7c272 ci: bump actions/cache
Bumps the github-actions group with 1 update in the /.github/actions/cache directory: [actions/cache](https://github.com/actions/cache).


Updates `actions/cache` from 4 to 5
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-26 13:44:19 +01:00
luukvbaal
d80d7a3eb4 fix(ui2): no paging in dialog below expanded cmdline #38489
Problem:  When entering the cmdline below expanded messages, those
          messages are moved to the dialog window. The dialog window
          supports paging but that is unexpected in this situation where
          it just serves to keep (some of, exactly those that were
          visible before the cmdline was entered) the messages visible.
          Wrong highlight group for dialog "more" message.
Solution: Don't create the `vim.on_key()` dialog pager callback after
          entering the cmdline below expanded messages.
          Use the MsgMore highlight group for the paging hint title.
2026-03-26 05:55:23 -04:00
github-actions[bot]
77f2a478c8 docs: update version.c #38455
vim-patch:9.2.0234: test: Test_close_handle() is flaky
vim-patch:a603175c6 runtime(manpager): use \x07 instead of \a for BEL in OSC 8 regex
vim-patch:9.2.0245: xxd: color output detection is broken
vim-patch:9.2.0247: popup: popups may not wrap as expected
vim-patch:e09000a78 runtime(doc): Update examples in xxd.1 manpage
vim-patch:be7ef8a19 translation(it): Update Italian xxd man page

vim-patch:9.2.0242: memory leak in check_for_cryptkey()
vim-patch:9.2.0243: memory leak in change_indent()
vim-patch:9.2.0244: memory leak in eval8()
vim-patch:9.2.0246: memory leak in globpath()
2026-03-26 05:49:02 -04:00
Shadman
3e6d5875ca refactor(progress): simplify progress-status format #38491
Problem:
Currently we are using
if 1 item then
  {title}: {percent}%
else
  Progress: {AVG}%({N})
dropping {title} and Progress text saves up space in statusline plus makes the format consistent, less jumping around.

Solution:
Use `{AVG}%({N})` for all cases.
2026-03-26 05:47:16 -04:00
Willaaaaaaa
c9e961994b refactor: resize Progress autocmd dict to actual size #38487
Problem:
  The temp_dict in `do_autocmd_progress()` is sized 7, but the max is 6 (id, text, percent, status, title, data). The extra capacity is rather misleading.

Solution:
  make the size of the dict 6.
2026-03-25 17:00:46 -04:00
Lewis Russell
ea878f456a fix(treesitter): ignore stale fold refresh callbacks
Problem:

The fold refresh path for foldminlines/foldnestmax creates a new
FoldInfo and starts an async parse. If FileType or BufUnload re-enters
before that callback returns, foldinfos[bufnr] can be cleared or
replaced. The callback then indexes a stale slot and raises an "attempt
to index a nil value" error.

Solution:

Capture the FoldInfo created for the refresh and carry that object
through the async callback. Before calling foldupdate(), verify that the
buffer still points at the same FoldInfo generation; otherwise ignore
the stale callback.

AI-assisted: Codex

Fixes #38461
2026-03-25 16:12:52 +00:00
Sean Dewar
b233f71b1b fix: :ball w_locked check, reset b_nwindows in free_all_mem() #38484
Problem:
- Small error in port of v9.1.0678, causing :ball to check w_locked for the
  wrong window.
- After #27439, free_all_mem() may not wipe out buffers that were open in more
  than one window before windows were freed.

Solution:
- Check win_locked() for wp in ex_buffer_all(), not curwin.
- Set b_nwindows to 0 in free_all_mem() before calling close_buffer().

Ref: https://github.com/neovim/neovim/pull/38473#issuecomment-4125117681
No need to block these fixes on that.

free_all_mem() change also looks like it fixed the existing "N lua references were
leaked!" warnings on the CI.
2026-03-25 10:47:12 +00:00
glepnir
4d04d0123d feat(api): nvim_set_hl{update:boolean} #37546
Problem: nvim_set_hl always replaces all attributes.

Solution: Add update field. When true, merge with existing
attributes instead of replacing. Unspecified attributes are preserved.
If highlight group doesn't exist, falls back to reset mode.
2026-03-25 06:01:50 -04:00
altermo
170ff4b244 refactor(treesitter): use same visual-select as lsp #38475
Problem
treesitter select over-complicates visual selection.

Solution
make it use same visual selection logic as lsp.
2026-03-25 05:20:42 -04:00
zeertzjq
40a42affa5 test: work around flaky swapfile test with ASAN (#38482)
FAILED   test/functional/ex_cmds/swapfile_preserve_recover_spec.lua @ 118: preserve and (R)ecover with custom 'directory' killing TUI process without :preserve #22096
test/functional/ex_cmds/swapfile_preserve_recover_spec.lua:132: Failed to match any screen lines.
Expected (anywhere): "%[Process exited 1%]"
Actual:
  |{UNEXPECTED background = Screen.colors.NvimLightGrey2, foreground = Screen.colors.NvimDarkGrey2:^sometext                                             }|
  |[Process exited 129]{UNEXPECTED background = Screen.colors.NvimLightGrey2, foreground = Screen.colors.NvimLightGrey4:                                 }|
  |{UNEXPECTED background = Screen.colors.NvimLightGrey2, foreground = Screen.colors.NvimLightGrey4:~                                                    }|
  |{UNEXPECTED background = Screen.colors.NvimLightGrey2, foreground = Screen.colors.NvimLightGrey4:~                                                    }|
  |{UNEXPECTED background = Screen.colors.NvimLightGrey2, foreground = Screen.colors.NvimLightGrey4:~                                                    }|
  |{UNEXPECTED background = Screen.colors.NvimLightGrey2, foreground = Screen.colors.NvimLightGrey4:~                                                    }|
  |{UNEXPECTED background = Screen.colors.NvimLightGrey2, foreground = Screen.colors.NvimLightGrey4:~                                                    }|
  |{UNEXPECTED background = Screen.colors.NvimLightGrey2, foreground = Screen.colors.NvimLightGrey4:~                                                    }|
  |{UNEXPECTED background = Screen.colors.NvimLightGrey2, foreground = Screen.colors.NvimLightGrey4:~                                                    }|
  |{UNEXPECTED background = Screen.colors.NvimLightGrey2, foreground = Screen.colors.NvimLightGrey4:~                                                    }|
  |{UNEXPECTED background = Screen.colors.NvimLightGrey2, foreground = Screen.colors.NvimLightGrey4:~                                                    }|
  |{UNEXPECTED background = Screen.colors.NvimLightGrey4, foreground = Screen.colors.NvimDarkGrey2:Xtest_recover_file1 [+]            1,8            All}|
  |{UNEXPECTED background = Screen.colors.NvimLightGrey2, foreground = Screen.colors.NvimDarkGrey2:                                                     }|
  |                                                     |
2026-03-25 13:04:15 +08:00
zeertzjq
781ea5b41b fix(exit): stop listening before closing channels (#38480)
Fixes the following flaky test on FreeBSD:

FAILED   test/functional/terminal/tui_spec.lua @ 218: TUI :restart works
test/functional/testterm.lua:223: Row 1 did not match.
Expected:
  |*^                                                  |
  |*{100:~                                                 }|
  |*{100:~                                                 }|
  |*{100:~                                                 }|
  |*{3:[No Name]                                         }|
  |*{MATCH:%d+ +}|
  |{5:-- TERMINAL --}                                    |
Actual:
  |*nvim: Failed to --listen: address already in use: |
  |*"/tmp/cirrus-ci-build/build/Xtest_tmpdir_terminal/|
  |*nvim.cirrus/LLdBdg/nvim.18878.1"                  |
  |*                                More info with "nv|
  |*im -h"                                            |
  |*[Proce^ss exited 1]                                |
  |{5:-- TERMINAL --}                                    |
2026-03-25 10:03:23 +08:00
zeertzjq
6dfcb2b784 vim-patch:9.2.0237: filetype: ObjectScript routines are not recognized (#38479)
Problem:  filetype: ObjectScript routines are not recognized
Solution: Add ObjectScript routines detection for .mac, .int, and .inc
          files (Hannah Kimura)

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

closes: vim/vim#19805

25f6539645

Co-authored-by: Hannah Kimura <hannah.kimura@intersystems.com>
2026-03-25 01:02:04 +00:00
zeertzjq
f806c77391 vim-patch:9.2.0239: signcolumn may cause flicker (#38477)
Problem:  Changing the 'signcolumn' may cause flicker, because it uses
          the P_RCLR flag for redrawing (Yggdroot)
Solution: Change 'signcolumn' to use P_RWIN instead of P_RCLR, matching
          the behavior of 'number' and 'foldcolumn'
          (Yasuhiro Matsumoto).

fixes:  vim/vim#19663
closes: vim/vim#19713

4292eea714

Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
2026-03-25 08:19:42 +08:00
zeertzjq
7f89f55b7c Merge pull request #38478 from zeertzjq/vim-9c0d057
vim-patch: sh syntax updates
2026-03-25 08:09:27 +08:00
zeertzjq
ecc2414eae vim-patch:955c02d: runtime(sh): Distinguish parts of function definitions
- Highlight keywords "function" and "namespace" with
  the "Keyword" group ("shFunctionKey").
- Highlight function body delimiters "{" and "}" with the
  "Delimiter" group ("shFunctionExprRegion").
- Highlight function body delimiters "(" and ")" with the
  "Operator" group ("shFunctionSubShRegion").
- Also, follow one style in folding all supported variants
  of function bodies for grouping commands too by enclosing
  a delimited function body, e.g. "{" and "}", in a fold and
  leaving its function header, e.g. "function f()", out of
  it when the header is written on a separate line.

To restore previous colouring, add to "after/syntax/sh.vim":
------------------------------------------------------------
hi link shFunctionKey Function
hi link shFunctionExprRegion Function
hi link shFunctionSubShRegion Function
------------------------------------------------------------

fixes:  https://github.com/vim/vim/pull/19638#issuecomment-4052635546
closes: vim/vim#19638

955c02dff7

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2026-03-25 07:38:22 +08:00
zeertzjq
cedafc86df vim-patch:9c0d057: runtime(sh): Improve the matching of function definitions
- Drop the remaining undefined "shFunctionStart" references
  (gone in v7.2b.000, c236c16d0).
- Revise nestable contexts where function definitions are
  supported:
  * Stop looking for function definitions in arithmetic
    expressions.
  * Recognise function definitions enclosing other function
    definitions.
- In addition to grouping commands "{}" and "()", also match
  other compound commands (e.g. "if"; see "shFunctionCmd*")
  whenever these commands are supported as complete function
  bodies.
- Balance body delimiters "(" and ")" for "shFunctionFour"
  in Bash; match such function bodies whenever the use of
  the function parameter list "()" token is optional, i.e.
  when the "function" reserved word is present.
- Enable the use of "shFunctionFour" definitions.
- Do not claim optional leading whitespace characters before
  a matched function definition.
- Prefer patterns with ASCII atoms (e.g. "\h") to equivalent
  collections (e.g. "[A-Za-z_]") for speed.
- Accommodate word-boundary assertions in function name
  patterns to names that may start and/or end with supported
  non-word characters, e.g. "@test:".
- Match more valid function names in Bash: non-ASCII names,
  non-word names.
- Allow for function names with "do", "done", etc. prefixes;
  confine these name checks to "shDoError" and "shIfError".

fixes:   vim/vim#19619
related: vim/vim#19638

References:
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_09_04
https://gitweb.git.savannah.gnu.org/gitweb/?p=bash.git;a=blob_plain;f=doc/bash.html;hb=637f5c8696a6adc9b4519f1cd74aa78492266b7f
https://web.archive.org/web/20151105130220/http://www.research.att.com/sw/download/man/man1/ksh88.html
https://web.archive.org/web/20151025145158/http://www2.research.att.com/sw/download/man/man1/ksh.html
http://www.mirbsd.org/htman/i386/man1/mksh.htm

9c0d057e3d

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Co-authored-by: Johnothan King <johnothanking@protonmail.com>
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-03-25 07:38:21 +08:00
Justin Mayhew
b02d1303b8 fix(pack): add trailing newline to lockfile #38469
Problem: JSON files should end with a trailing newline so that Unix
  tools work as expected, Git doesn't report "No newline at end of file"
  and to avoid noise in diffs from editors and other tools adding the
  missing newline.

Solution: Add trailing newline.
2026-03-24 13:23:17 -04:00
luukvbaal
81828e66b9 fix(messages): emit empty msg_show event for :echo #38467
Problem:  No empty msg_show event for :echo without arguments.
Solution: Emit empty msg_show event when :echo is invoked without arguments.
2026-03-24 10:47:12 -04:00
luukvbaal
b2adfe775d fix(ui2): show messages in dialog window when entering expanded cmdline #38465
Problem:  - With expanded messages exceeding cfg.msg.cmd.height, entering
            the cmdline scrolls to the bottom and expands to the full "cmd"
            buffer text height.

          - Cursor in the pager is not always at the last message and at
            the bottom of the window when appending to the pager.

          - unreliable test: messages2_spec: "closed msg window timer removes
            empty lines".
Solution: - Achieve separation of the cmdline and message text by moving
            messages to the dialog window when entering the cmdline below
            expanded messages.

          - Set cursor to start of the first message only when first
            entering the pager. Use `norm! zb` to position last message
            at the bottom of the window (which shouldn't crash anymore
            since 911337eb).

          - Increase cfg.msg.msg.timeout used in the test file.
2026-03-24 09:53:25 -04:00
Yochem van Rosmalen
042c66e4f9 docs: job-control.txt => flow layout #38463 2026-03-24 08:30:23 -04:00
Shadman
0af01948f3 fix(progress): show progress-status only in curwin #38458
Problem:
Currently same progress stat get's displayed on statusline of all
windows. This is repeatitive and noisy.

Solultion:
Only display progress-status on the focused window

Problem:
Currently, when multiple progress are on going we show it as Progress:
{N} items {percent}% format. It can be simplified sinnce items doesn't
really add enough value for the valuable space it takes in statusline

Solution:
Change format to Progress: {percent}%({N})
2026-03-24 08:28:44 -04:00
Yochem van Rosmalen
10ca09a2cb fix(vim.net): always pass response body to on_response #38460
Problem:
on_response(err, response) handler doesn't receive a response when an
output buffer or path is supplied to vim.net.request. User might want to
both output output to a file/buffer and also do something with it on
response.

Solution:
If an on_response handler was given, then pass the response to it.
2026-03-24 07:30:00 -04:00
Justin M. Keyes
ebc9811149 Merge #38402 from justinmk/doc2 2026-03-24 06:56:01 -04:00