Commit Graph

37778 Commits

Author SHA1 Message Date
zeertzjq
40740f49f8 vim-patch:9.2.0982: tests: test_substitute leaves swapfiles behind (#41390)
Problem:  tests: test_substitute leaves swapfiles behind
Solution: Close open buffer using :bw!

be66c98572

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-08-20 01:51:34 +00:00
zeertzjq
0e140ded51 vim-patch:bce3eb1: runtime(doc): clarify the 'findfunc' option (#41389)
Remove the note about "this function is called only once per :find
command invocation".

fixes: vim/vim#21062

bce3eb1fae

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-08-20 09:11:13 +08:00
Justin M. Keyes
b997265f64 Merge #41376 from justinmk/fixci 2026-08-19 15:22:25 -04:00
Justin M. Keyes
2fea699b96 revert: "fix(lifecycle): on Windows, CTRL_CLOSE kills Nvim mid-teardown"
Revert commit 5a71131282

That change seems good in theory, but it consistently causes 2 failures

    FAILED   …/api/vim_spec.lua @ 3213: API nvim_list_chans, nvim_get_chan_info stream=job :terminal channel
    Expected values to be equal.
    Expected:
    {
      argv = { "D:/a/neovim/neovim/build/bin/nvim.exe", "-u", "NONE", "-i", "NONE" },
      exitcode = 129,
      id = 4,
      mode = "terminal",
      pty = "?",
      stream = "job"
      ...
    }
    Actual:
    {
      argv = { "D:/a/neovim/neovim/build/bin/nvim.exe", "-u", "NONE", "-i", "NONE" },
      exitcode = 143,
      id = 4,
      mode = "terminal",
      pty = "?",
      stream = "job",
      ...
    }
    stack traceback:
            …/api/vim_spec.lua:3257: in function <…/api/vim_spec.lua:3213>

    FAILED   …/terminal/tui_spec.lua @ 3669: TUI exits immediately when stdin is closed
    …/terminal/tui_spec.lua:3669: retry() attempts: 69
    Expected values to be equal.
    Expected:
    vim.NIL
    Actual:
    {
      name = "nvim.exe",
      pid = 2256,
      ppid = 8200,
    }
    stack traceback:
            …/testutil.lua:98: in function 'retry'
            …/terminal/tui_spec.lua:3669: in function <…/terminal/tui_spec.lua:3656>
2026-08-19 20:36:14 +02:00
Justin M. Keyes
5a71131282 fix(lifecycle): on Windows, CTRL_CLOSE kills Nvim mid-teardown
Problem:
`signal_ignore_deadly` doesn't work for Windows, where the console still
may terminate Nvim during teardown (after `signal_teardown`), while it
is already trying to exit. Besides interrupting any housekeeping we are
doing, it results in an unpredictable exit code (flaky tests).

    [Process exited -1073741510]  // 0xC000013A STATUS_CONTROL_C_EXIT

Solution:
Register our own CTRL_CLOSE_EVENT handler which "blocks" the signal.
Note: if exit takes longer than 5s, Windows will consider the process
"hung" and kill it anyway.
2026-08-19 15:46:58 +02:00
Justin M. Keyes
5b1c21f4b8 fix(lifecycle): late signal kills Nvim mid-teardown
Problem:
A deadly signal arriving during teardown can kill Nvim while it is
preserving swapfiles. `os_exit()` ignores deadly signals via
`signal_reject_deadly()`, but `signal_teardown()` => `uv_signal_stop()`
resets them to the default behavior, so SIGHUP arriving after that
kills the process:

    [Process exited 129]      // 128 + SIGHUP

This is a race when closing a pty: kernel sends SIGHUP to foreground
process group *and* the reads return EOF, so `chanclose()` on a TUI job
prepares to exit twice. This means it is unpredictable whether Nvim
exits 1 or is terminated.

Solution:
Ignore deadly signals once the watchers are closed. Only SIGKILL
interrupts it now.
2026-08-19 15:46:58 +02:00
Justin M. Keyes
9bd18d04f1 revert: "build(deps): bump luajit to 27f169c6c" #41380
This reverts commit fce4d4502a.
2026-08-19 09:46:42 -04:00
zeertzjq
2cd4229d01 fix(window): crash when closing new curwin during CTRL-W_x (#41378)
Problem:  Crash when closing the new current window during CTRL-W_x.
Solution: Remove a duplicate redraw of a window that should normally be
          already mark for redraw in the previous call.
2026-08-19 20:13:08 +08:00
Christian Clason
fce4d4502a build(deps): bump luajit to 27f169c6c 2026-08-19 13:40:02 +02:00
Barrett Ruth
743bca9202 fix(zip): lost password if sent before unzip disables echo #41377 2026-08-19 07:35:26 -04:00
Justin M. Keyes
0a414a7fbb vim-patch: num -> bool patches #41375
Notes:
- 8.2.1614 also flips searchcount()'s "recompute" default to FALSE;
- 8.2.1620 flips it back, so the default stays true here.

vim-patch:8.2.1601: Vim9: cannot use 'true" with garbagecollect()
2df4731042

vim-patch:8.2.1602: Vim9: cannot use 'true" with getbufinfo()
036c2cf719

vim-patch:8.2.1603: Vim9: cannot use "true" with getchar()
c08cc72947

vim-patch:8.2.1604: Vim9: cannot use "true" with getcompletion()
d217a87755

vim-patch:8.2.1614: Vim9: cannot pass "true" to searchcount()
597aaac9d2

vim-patch:8.2.1615: Vim9: cannot pass "true" to searchdecl()
30788d3d37

vim-patch:8.2.1616: Vim9: cannot pass "true" to synID()
fcb6d7082d

vim-patch:8.2.1617: Vim9: cannot pass "true" to win_splitmove()
4b9bd692bd

vim-patch:8.2.1619: Vim9: cannot pass "true" to spellsuggest()
7c27f337bf

vim-patch:8.2.1620: searchcount() test fails
4140c4f3ff

N/A patches:
vim-patch:8.2.1606: has() takes no second argument in Nvim
04637e243d
vim-patch:8.2.1610: list2str()/str2list() take no "utf8" argument
a48f786787
vim-patch:8.2.1611: nr2char() ignores its "utf8" argument
ed6a430fae
2026-08-19 07:18:34 -04:00
Justin M. Keyes
b1ce3d3eb7 Merge #41372 from janlazo/na-patch-9010000
build(vim-patch): detect n/a patch from vim9,popupwin,tabpanel
2026-08-19 04:00:19 -04:00
Justin M. Keyes
9b2dbc264b Merge #41370 from justinmk/fixci 2026-08-19 03:52:46 -04:00
Jan Edmund Lazo
3e487dd145 build(vim-patch): n/a tabpanel docs from v9.1.1391 2026-08-19 01:24:03 -04:00
Jan Edmund Lazo
c8da9f3df2 build(vim-patch): n/a patterns for popupwin. v9.2.0636 2026-08-19 00:49:08 -04:00
Jan Edmund Lazo
855e973bf2 build(vim-patch): v9.1.0050 is n/a 2026-08-19 00:16:44 -04:00
Jan Edmund Lazo
ba32f10632 build(vim-patch): vim9 parse_argument_types is n/a
Vim9script has incompatible lambda syntax to support argument types.
Target v9.1.0270.
2026-08-19 00:08:00 -04:00
Jan Edmund Lazo
a98858651e build(vim-patch): n/a docs from 9.0.1481, keep hunks without header
switch/case and goto labels v9.0.1481 and similar patches
from auto-N/A.
Blacklist as much as possible to auto-N/A later crypt patches.

Hunks without header in "*.h" is valid if only littered with #ifdefs
or change is isolated to 1st line
but "src/feature.h" should be mostly N/A
after Nvim removed "FEAT_" guards.
Wonder if certain patches with only "*.h" changes were mistakenly
marked N/A.
2026-08-18 21:40:04 -04:00
zeertzjq
53211ade2b vim-patch:9.2.0969: runtime(shaderslang): matchit % breaks on braces (#41371)
Problem:  b:match_words groups "{" with the if/for/while/switch keywords
          and "}" with "break" which breaks % matching on braces
Solution: Drop the brace and bracket groups, matchit appends
          'matchpairs' by itself (Matthias Bruns).

matchit counts every alternative in a group instead of pairing the
alternatives with each other.  Listing `{` alongside the if, for,
while, switch, struct and class keywords therefore makes a line such
as `for (...) {` count as two openers, and listing `break` alongside
`}` lets a brace pair with a break statement.  As a result % on the
opening brace of a function does not move at all, and % on
`switch (x) {` jumps to `break;` instead of the closing brace.

Braces and brackets do not need to be listed: matchit appends
'matchpairs' to b:match_words by itself.  Drop them and leave the
preprocessor group unchanged.

closes: vim/vim#21064

08c74ce09a

Co-authored-by: Matthias Bruns <matthiasbruns35@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 07:47:24 +08:00
Chen, Ting-An
b524338261 fix(l10n): refresh Traditional Chinese message catalog #41273
Problem:
The zh_TW catalog was stale, omitted 743 messages from the current source, and contained empty, fuzzy, and format-unsafe translations.

Solution:
Regenerate the catalog with the official translation build, preserve the focused translation repairs, and translate the reported E5200 diagnostic.
2026-08-18 16:27:14 -04:00
Justin M. Keyes
73e766f8f6 fix(lifecycle): json_create_config leak
Problem:
As it turns out, when you have 17 different ways to "exit", you need to
plug 17 different holes.

Leak still reported by ASAN CI, even after 1eae512285 f238788601.

    ERROR: LeakSanitizer: detected memory leaks
        strbuf_init src/cjson/strbuf.c:62:22
        json_create_config src/cjson/lua_cjson.c:635:5
        lua_cjson_new src/cjson/lua_cjson.c:2060:5
        nlua_state_add_stdlib src/nvim/lua/stdlib.c:840:3
        nlua_state_init src/nvim/lua/executor.c:973:3

Analysis:
`os_breakcheck()` may process a `exit_event` placed by
`exit_on_closed_chan()` during shutdown. This would re-enter
`preserve_exit()`, which then skips everything because it sees
`really_exiting=true`.

Solution:
Set `exiting` in `preserve_exit()`, not only in `getout()`.
2026-08-18 21:43:35 +02:00
Justin M. Keyes
c184ca2c68 fix(lifecycle): ignore signals during os_exit
Problem:
SIGTERM received during `os_exit()` can cause it to "nest":

    os_exit src/nvim/main.c:720
    preserve_exit src/nvim/main.c:910
    deadly_signal src/nvim/os/signal.c:205
    on_signal src/nvim/os/signal.c:240
    signal_event src/nvim/event/signal.c:45
    multiqueue_process_events src/nvim/event/multiqueue.c:159
    event_teardown src/nvim/main.c:178
    os_exit src/nvim/main.c:720

Solution:
Call `signal_reject_deadly()` at the start of `os_exit()` like
`preserve_exit()` already does.
2026-08-18 18:04:19 +02:00
Justin M. Keyes
f238788601 fix(tui): ui may attempt reattach during shutdown #41368
Problem:
TSan CI, always at exit:

    WARNING: ThreadSanitizer: use of an invalid mutex (e.g. uninitialized or destroyed)
        #1 uv_mutex_lock
        #2 tui_flush src/nvim/tui/tui.c:1708
        #3 ui_client_event_flush
        #4 parse_msgpack src/nvim/msgpack_rpc/channel.c:259
        ...
        #10 event_teardown src/nvim/main.c:187
        #11 os_exit src/nvim/main.c:720
        ...
        #19 tinput_done_event src/nvim/tui/input.c:184

Analysis (guess):
`rpc_close_event()` may run during `event_teardown()` and reattach to
a restarted server, then `ui_client_attached=true` gets set and redraws
resume in an already-stopped TUI.

Solution:
Check `!exiting` in `rpc_close_event`, like we already do in
`channel_proc_exit_cb()`.
2026-08-18 11:38:52 -04:00
Justin M. Keyes
0c091cedc2 test(tui): unreliable "TUI exits immediately when stdin is closed" #41367
Problem:
Unreliable test on slow CI (ASAN/TSAN):

    FAILED  .../tui_spec.lua @ 3054: TUI exits immediately when stdin is closed
    retry() attempts: 1
    Expected: vim.NIL
    Actual: { name = "nvim", pid = 33201, ppid = -1 }

The test asserts "immediate" exit of the Nvim process, but this may be
subject to OS delays outside of our control.

Solution:
Make the "timed out waiting for DA1" log conditional on the actual
timeout, and assert the logs in the test.
2026-08-18 09:22:05 -04:00
Goldpigg
ab82c2c6b0 feat(extmark): virt_lines can highlight until EOL #41289 2026-08-18 08:35:22 -04:00
Justin M. Keyes
1eae512285 fix(lifecycle): Lua state not freed if free_all_mem() is re-entered #41366
Problem:
Leak reported by ASAN CI, always at Lua state init.

      ERROR: LeakSanitizer: detected memory leaks
          strbuf_init src/cjson/strbuf.c:62:22
          json_create_config src/cjson/lua_cjson.c:635:5
          lua_cjson_new src/cjson/lua_cjson.c:2060:5
          nlua_state_add_stdlib src/nvim/lua/stdlib.c:840:3
          nlua_state_init src/nvim/lua/executor.c:973:3
      ...
      SUMMARY: AddressSanitizer: 1055 byte(s) leaked in 2 allocation(s).

Analysis:
`getout()` may run during `free_all_mem()` (that's why it checks
`!entered_free_all_mem`). If that happens, the second `os_exit()`
returns early from `free_all_mem()` then `exit()` is called and Lua
state is never closed.

Solution:
Always call `nlua_free_all_mem()` in the early-return case.
2026-08-18 08:30:42 -04:00
Justin M. Keyes
f6bf814378 fixfix(cmdatom): repeat Visual <Cmd>; CmdFrame + stage #41355
Problem:
- Dot-repeat of a Visual selection prepared by a `<Cmd>` mapping,
  results in E1255 and leaves Visual mode active.
- Visual-mode capture is implemented as a second, parallel "capture
  engine": it re-composes a CmdSpec from cmdarg_T per key and decides
  replayability from its own table of "void" key classes.

Solution:
- Model nested `normal_execute()` as a `CmdFrame` stack,
  instead of a single module-scoped `stage`.
  - Capture `<Cmd>` ":norm …" commands as subatoms from its nested frames.
- Produce every command exactly once; atom_push_raw() routes the atom to
  the Visual composite while a selection is open, like it already does
  for mapping composites.
  - `v/pat<CR>d` is now repeatable and cascades.
2026-08-18 07:50:27 -04:00
Justin M. Keyes
c5ea9ca2ad fix(zip): missed "password:" prompt if output trails it #41364
Problem:
Flaky test:

    RUN      T1158 nvim.zip reports an incorrect archive password: 11092.84 ms FAIL

The prompt is detected only if the pty output *ends* with "password: ",
but a read may return the prompt plus following bytes.

Solution:
- Match anywhere in the output since the last password was sent. The
  buffer is cleared before each send, so won't match stale text.
- Assert on the reported message, so a failure shows what was reported.
2026-08-18 06:23:59 -04:00
Marcus Caisey
d9b4fb1273 feat(lsp): fallback to textDocument/formatting from vim.lsp.formatexpr #40079
Problem:
With the addition of the `:help al` text object, you can now easily
format the whole buffer with `gqal`. However, `vim.lsp.formatexpr` only
uses `textDocument/rangeFormatting` which some language servers (like
gopls) don't support.

Solution:
- Fall back to `textDocument/formatting` if the whole buffer is being formatted
  and the server doesn't support `textDocument/rangeFormatting`.
  - In theory, these two methods should return the same response if the whole
    buffer is being formatted, but I preserved the existing behaviour of
    prioritising `textDocument/rangeFormatting` in case that does not hold (i.e.
    LS bug).
- Also: `vim.lsp.formatexpr` had no tests at all, so actually add tests for it.
2026-08-18 05:16:16 -04:00
Justin M. Keyes
27d40762bc Merge #41350 from janlazo/vim-8.1.1880
vim-patch:8.1.1880,9.0.0885
2026-08-18 04:35:47 -04:00
Max Coplan
750c665ab3 build(zig): keep all symbols for native Lua modules #41361
Native Lua modules loaded with `require` or `package.loadlib` resolve Lua
C API symbols from the nvim executable itself. Those symbols must stay in
the binary even when nothing inside nvim references them.

`rdynamic` is enough on Linux. On macOS the linker dead-strips
unreferenced symbols before rdynamic exports them, so `_lua_tothread` is
missing from the executable and loading such a module fails with:

    symbol not found in flat namespace '_lua_tothread'

Disable section garbage collection so all non-static symbols are kept.
2026-08-18 04:16:35 -04:00
github-actions[bot]
4a77d1e1db docs: update version.c #41307
vim-patch:8.2.0514: several global functions are used in only one file
vim-patch:8.2.1814: missing change to remove "static"
vim-patch:8.2.2860: adding a text property causes the whole window to be redawn
vim-patch:8.2.3276: Vim9: exists() can only be evaluated at runtime
vim-patch:8.2.3753: Vim9: function unreferenced while called is never deleted
vim-patch:8.2.4669: in compiled code len('string') is not inlined
vim-patch:9.0.1821: Vim9 constructors are always static
vim-patch:9.0.1953: Misplaced comment in errors.h
vim-patch:9.1.0349: Vim9: need static type for typealias
vim-patch:9.1.0584: Warning about redeclaring f_id() non-static
vim-patch:ae3a8664b runtime(doc): Add explanation for Vim's IME
vim-patch:9.1.2033: tests: Test_terminal_cwd flaky when using ConPTY
vim-patch:9.2.0026: The ss_pending_cmds variable is visible globally
vim-patch:9.2.0643: Missing Image ifdefs
vim-patch:381da9f85 CI: Bump github/codeql-action
vim-patch:9.2.0965: GTK4: blurry text rendering
vim-patch:9.2.0966: GTK4: window opens two lines too small
vim-patch:0b7700e1a runtime(doc): add PREVENT LOADING section for pi_getscript.txt
vim-patch:068657ffc runtime(vimlogo): remove coincident lines and reshade vimlogo.svg

vim-patch:8.2.0149: maintaining a Vim9 branch separately is more work
vim-patch:8.2.0173: build fails with old compiler
vim-patch:8.2.0191: cannot put a terminal in a popup window
vim-patch:8.2.0194: some commands can cause problems in terminal popup
vim-patch:8.2.0196: blocking commands for a finished job in a popup window
vim-patch:8.2.0202: when 'lazyredraw' is set the window title may not be updated
vim-patch:8.2.0204: crash when using winnr('j') in a popup window
vim-patch:8.2.0320: no Haiku support
vim-patch:8.2.0328: no redraw when leaving term-normal mode in popup terminal
vim-patch:8.2.0364: printf test failing on Haiku
vim-patch:8.2.0367: can use :pedit in a popup window
vim-patch:8.2.0399: various memory leaks
vim-patch:8.2.0516: client-server code is spread out
vim-patch:8.2.0557: no IPv6 support for channels
vim-patch:8.2.0574: ipv6 feature not shown in :version output
vim-patch:8.2.0588: Putty does not use "sgr" 'ttymouse' by default
vim-patch:8.2.0596: crash in test49
vim-patch:8.2.0611: Vim9: no check for space before #comment
vim-patch:8.2.0613: Vim9: no check for space before #comment
vim-patch:8.2.0624: Vim9: no check for space before #comment
vim-patch:8.2.0641: Vim9:  not expanded in :hardcopy and syn-include
vim-patch:8.2.0650: Vim9: script function can be deleted
vim-patch:8.2.0653: using uninitialized pointer
vim-patch:8.2.0656: MS-Windows: redrawing right screen edge may not be needed
vim-patch:8.2.0694: Haiku: channel and terminal do not work
vim-patch:8.2.0718: gcc warning for returning pointer to local variable
vim-patch:8.2.0747: cannot forcefully close all popups
vim-patch:8.2.0748: cannot get a list of all popups
vim-patch:8.2.1601: Vim9: cannot use 'true" with garbagecollect()
vim-patch:8.2.1602: Vim9: cannot use 'true" with getbufinfo()
vim-patch:8.2.1603: Vim9: cannot use "true" with getchar()
vim-patch:8.2.1604: Vim9: cannot use "true" with getcompletion()
vim-patch:8.2.1606: Vim9: cannot use "true" with has()
vim-patch:8.2.1610: Vim9: cannot pass "true" to list2str() and str2list()
vim-patch:8.2.1611: Vim9: cannot pass "true" to nr2char()
vim-patch:8.2.1614: Vim9: cannot pass "true" to searchcount()
vim-patch:8.2.1615: Vim9: cannot pass "true" to searchdecl()
vim-patch:8.2.1616: Vim9: cannot pass "true" to synID()
vim-patch:8.2.1617: Vim9: cannot pass "true" to win_splitmove()
vim-patch:8.2.1619: Vim9: cannot pass "true" to spellsuggest()
vim-patch:8.2.4597: LuaV_debug() not covered by tests
vim-patch:8.2.4648: handling LSP messages is a bit slow
vim-patch:8.2.4650: "import autoload" only works with using 'runtimepath'
vim-patch:8.2.4653: "import autoload" does not check the file name

vim-patch:8.2.0528: Vim9: function arguments insufficiently tested
vim-patch:9.0.0375: the footer feature is unused
vim-patch:9.1.0202: leaking memory in add_user() on failure
2026-08-18 03:32:47 -04:00
zeertzjq
82c751db4e vim-patch:9.2.0967: hit-enter prompt eats keys from a running mapping (#41359)
Problem:  The hit-enter prompt fires whenever a message scrolls the screen.
          When this happens while a mapping is being processed, it consumes
          the mapping's next key, causing unexpected behavior for users.
Solution: Similar to what 9.1.1969 did for stuffed characters, skip the
          hit-enter prompt when there are still keys pending from a mapping
          in the typeahead buffer.

related: neovim/neovim#38298
related: neovim/neovim#20635
related: neovim/neovim#30890
closes:  vim/vim#20753

AI assisted.

6025ea9e02

Co-authored-by: XiaowenHu96 <me@xiaowenhu.com>
2026-08-18 09:23:34 +08:00
zeertzjq
bce3bf06a3 vim-patch:9.2.0963: crash when sound-folding a crafted spell file (#41358)
Problem:  A SAL rule longer than MAXWLEN is silently truncated to an
          empty lead.  set_sal_first() then reorders the sl_sal entries
          by their index byte and can move the terminating sentinel out
          of the last slot, so spell_soundfold_wsal() reads past the end
          of the array, e.g. when soundfold() or spellsuggest() is used
          (Erick Alex).
Solution: Bound the sound-folding loops against sl_sal.ga_len.

closes: vim/vim#21076

6ac008db96

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-18 09:03:37 +08:00
zeertzjq
cc25b2f13c vim-patch:9.2.0960: double-free in string_reduce() (#41357)
Problem:  string_reduce() copies *rettv into argv[0] before calling
          eval_expr_typval().  When the evaluator fails early, rettv is
          never reset and still aliases argv[0] v_string.
          clear_tv(&argv[0]) frees it, leaving rettv dangling and when
          in vim9script get_func_tv() frees it again (Ave Dva).
Solution: Set rettv->v_type = VAR_UNKNOWN like what is done in
          list_reduce() and tuple_reduce(), use tv_get_string_strict()
          in f_reduce()

closes: vim/vim#21048

Supported by AI.

cd59994c45

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-08-18 09:03:27 +08:00
Justin M. Keyes
b107154ba2 docs: misc, cwd, vimscript.txt #41356
Extract vimscript.txt from repeat.txt
2026-08-17 13:37:08 -04:00
Jan Edmund Lazo
a7ca7ed318 vim-patch:9.0.0885: informational message has an error message number
Problem:    Informational message has an error message number.
Solution:   Use a message without an error number. (closes vim/vim#11530)

b53a190e9f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-17 09:33:44 -04:00
Rob Pilling
a4aa0417cf feat(ui2): drop default enter-pager-via-CR mapping #40993 2026-08-17 08:03:29 -04:00
Justin M. Keyes
98053bfecf perf(input): drop buffheader_T #41353
Problem:
`buffheader_T` is a linked list (Vim's favorite data structure) with
complex bookkeeping, optimized for ancient hardware:

1. Memory topology: On old platforms (Amiga 512KB without MMU, MS-DOS
   64KB segments), large contiguous allocations were hazardous (no VM).
2. Never-move appends: `add_buff()` fills spare space or links a new
   block.
3. OOM "recovery": a failed block allocation only loses one append.

To avoid OOM, it prefers to allocate small, linked chunks, instead of
resizing one continguous slice. Each stuff/drain cycle costs
a malloc+free.

Solution:
Replace Vim's favorite data structure with Nvim's favorite data structure.

Nvim doesn't have granular handling of OOM (`xmalloc`), and hardware has
changed: caches favor contiguous memory, allocators handle
fragmentation. And these buffers are ~kb scale, so OOM is irrelevant on
any system that can run Nvim.

- Use a flat `StringBuilder` + `read`/`insert` offsets.
- Keeps capacity (does not shrink) until `free_buff`.
- "Steady state" allocates nothing: 1 fewer malloc+free per dot-repeat.
2026-08-17 07:55:47 -04:00
Justin M. Keyes
5f07fc91c2 refactor(cmdatom): drop RedoBuf #41351
Problem:
`RedoBuf` is mostly indirection. It has a mild benefit as an "ownership"
signal but it counteracts the general goal of unifying how "redo state"
is passed throughout the system, tends to sprout redundant interfaces,
and reduces clarity.

Solution:
Add `CmdSpec.body` to hold the "prefixless" key sequence.
Reuse `CmdSpec` to represent a "redo" buf.
2026-08-17 05:37:06 -04:00
Jan Edmund Lazo
976d05b083 vim-patch:8.1.1880: cannot show extra info for completion in a popup window
Problem:    Cannot show extra info for completion in a popup window.
Solution:   Add the "popup" entry in 'completeopt'.

576a4a6ff1

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-17 02:13:09 -04:00
Justin M. Keyes
6947c8501d Merge #41349 from janlazo/na-patch-8.2.0000
build(vim-patch): n/a patch for error messages, FEAT_ guards, vim9 interface/types, static funcs
2026-08-17 02:07:15 -04:00
Justin M. Keyes
ea6abf15fe refactor(cmdatom): do "redo prep" in one place #41348
Problem:
Redo prep is scattered/duplicated.
- `do_pending_operator()` has 3 prep blocks whose conditions must be in
  sync with `atom_capture_op()`.
- insert.c, spell_suggest() hand-roll `redo_new()` + `redo_append_xx()`
  sequences.
- prep_redo() has 2 roles, decided by `keys != NULL`.

Solution:
- `atom_capture_op()` is the "operator" entry point: capture, then
  prep.
- Extract `prep_redo_visual()`, `atom_capturable()`.
2026-08-17 01:55:14 -04:00
Jan Edmund Lazo
e96be45bba build(vim-patch): v8.2.4153 is n/a 2026-08-16 23:28:43 -04:00
not_compiled
8c0bf18374 fix(spell): avoid invalid window state after async spell select (#41346)
Problem:
When `z=` delegates to `vim.ui.select()`, the picker may change the
current window before returning. `spell_suggest()` then continues to the
cursor restoration branch with the new window and assigns `prev_cursor`,
which belongs to the original window. This can leave Normal mode with an
invalid cursor position and produce E315.

Solution:
Clean up the spell suggestion state and return immediately after handing
control to `vim.ui.select()`.
2026-08-17 11:16:11 +08:00
Jan Edmund Lazo
cd71a13589 build(vim-patch): auto-n/a refactor patch like v8.2.0514
Follow-up refactor patches, mixed with unrelated patches in the middle,
is normal in vim-dev when the original patch is not fully tested
across all builds via CI or reviewed by others.

Unless core maintainers push "vim-patch:" directly to master/main branch
without running the full test-suite,
there is little reason to merge incomplete ports that will fail
on Nvim's CI or code review.

Relevant changes in patches like v8.2.0514 are either ported
or (will) become N/A.
2026-08-16 22:23:06 -04:00
Jan Edmund Lazo
19a7f26a9c build(vim-patch): n/a docs for v8.1.2219
Ignoring incompatible implementation,
TerminalOpen and TermOpen events are not 1-1.
"TerminalWinOpen" was accepted as N/A in
commit c7ee6af777 .

I planned to not do this to have more test cases
after manipulating the hunks header to filter out more hunks
but Justin is eager to just mark these N/A
to bump the Vim major.minor version.

Time to move on from v8.1.x.
2026-08-16 22:23:05 -04:00
Jan Edmund Lazo
833e58341c build(vim-patch): n/a ":terminal" opts
Target v8.1.2195 .

Nvim did not port Vim's ":terminal" opts.
Incompatible implementations.
Ex-command was ported from C to Lua.
Vim needs them partly because of splitting the current window.

I keep forgetting `++close` option so I either run ":qall!"
or kill the parent process (ie. terminal emulator).

Unsatisfied users should create their Ex-command that runs jobstart().
2026-08-16 21:22:15 -04:00
Jan Edmund Lazo
1e153b9a1c build(vim-patch): v9.2.0026 is n/a 2026-08-16 20:54:24 -04:00
Jan Edmund Lazo
fe5cf3259c build(vim-patch): v9.1.2033 is n/a 2026-08-16 20:54:24 -04:00