Commit Graph

37673 Commits

Author SHA1 Message Date
zeertzjq
7be8a8dda3 vim-patch:9.2.0932: NFA engine fallback can double free the compiled program (#41268)
Problem:  When the automatic regexp engine falls back to the
          backtracking engine in vim_regexec_string(), the compiled
          program is freed before the replacement is compiled; when
          saving the pattern fails from being out of memory the
          caller's "regprog" is left pointing to freed memory and
          is freed again.
Solution: Free the previous program only after compiling the
          replacement succeeded, like vim_regexec_multi() already
          does (Samuel Schlesinger).

closes: vim/vim#20986

cab0901f12

Co-authored-by: Samuel Schlesinger <sgschlesinger@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-08-11 10:19:52 +08:00
zeertzjq
5bc08dbb46 vim-patch:6163d99: runtime(doc): Improve :help expr-number, mention unary +/- (#41267)
- Mention unary +/- use in both integer and floating-point descriptions.
- Add "0b" binary prefix tag to match existing "0o" and "0x" tags.

closes: vim/vim#20997

6163d99a32

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-08-11 10:19:38 +08:00
zeertzjq
5f15c0e959 vim-patch:2e8c81e: runtime(strace): highlight stack trace as comment (#41266)
strace supports printing a complete stack trace for each syscall using
the `-k` (`--stack-trace`) flag. Highlight the trace as a comment.

closes: vim/vim#20998

2e8c81ea09

Co-authored-by: Josef Schönberger <josef.schoenberger@tum.de>
2026-08-11 01:30:08 +00:00
dependabot[bot]
e04196ea51 ci: bump the github-actions group across 1 directory with 3 updates
Bumps the github-actions group with 3 updates in the / directory: [github/codeql-action](https://github.com/github/codeql-action), [vmactions/freebsd-vm](https://github.com/vmactions/freebsd-vm) and [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action).


Updates `github/codeql-action` from 4.37.4 to 4.37.5
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v4.37.4...v4.37.5)

Updates `vmactions/freebsd-vm` from 1.5.2 to 1.5.3
- [Release notes](https://github.com/vmactions/freebsd-vm/releases)
- [Commits](77ed28d336...83b151f58c)

Updates `zizmorcore/zizmor-action` from 0.6.1 to 0.6.2
- [Release notes](https://github.com/zizmorcore/zizmor-action/releases)
- [Commits](6fc4b00623...3dc1ecc9bc)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.37.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: vmactions/freebsd-vm
  dependency-version: 1.5.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: zizmorcore/zizmor-action
  dependency-version: 0.6.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-10 15:24:05 +02:00
bfredl
8a0eb8f10b Merge pull request #41212 from bfredl/unmagic
refactor(ex_cmds): use function arguments for magic behavior
2026-08-10 14:17:57 +02:00
bfredl
344ea602f6 refactor(ex_cmds): use function arguments for magic behavior
Now this was a cargo cult anti-pattern to write home about.
Doing painful save-and-restore bookkeeping around a separate
`magic_overruled` decoy global is just as messy as doing painful
save-and-restore logic around `p_magic` itself. only that now you need
to wrap every access to the effective value in a function call.

This replaces this with a marvellous new Clean Code technique™:
passing in the intended behavior as a function parameter to functions
where either the option or an explicit value might be used.
2026-08-10 13:26:51 +02:00
Justin M. Keyes
5287a04be4 perf(mbyte): annotate pure functions #41251 2026-08-10 04:27:49 -04:00
Justin M. Keyes
2546741d1b fix(extmarks): undo-redo of a mark explicitly moved during an edit #41252
Problem:
A mark moved by nvim_buf_set_extmark() during an edit is misplaced by
undo and redo. Only splices ("edits") are recorded, and replaying them
reproduces the shifts they caused, never the explicit set: the mark ends
up wherever the text pushed it.

Solution:
When an open undo block moves an existing mark, record both positions.
Undo restores the pre-set position, redo re-applies the set.

Partially reverts 18334a4a0c ; ExtmarkSavePos.row/col were unused
because nothing recorded an explicit move, but now `extmark_set()` does.
2026-08-10 04:21:31 -04:00
Kyle
8d406ed2ac fix(defaults): emit events on automatic background change #41242
Problem:
After #40270, events are no longer emitted from the automatic background
detection. This applies not just during startup, but also if the user
manually changes the background of their terminal.

Solution:
Set the background as normal, assuming that a normal terminal will
respond within 100 ms. Change test to match expected behavior:
- BG set during startup won't trigger user autocmds since it runs before
  any user config
- If the terminal takes longer than 100 ms to respond to initial OSC 11,
  it does trigger the OptionSet, but it is triggered through the normal
  path to ensure values like v:option_new are set #38551
- BG change after startup still triggers autocmds #41146
2026-08-10 04:17:51 -04:00
HX L
4b8c4dfc68 fix(channel): handle socket accept failure #41240 2026-08-10 04:11:27 -04:00
github-actions[bot]
c64fb0767f docs: update version.c #41209
vim-patch:8.2.1300: Vim9: optional argument type not parsed properly
vim-patch:8.2.1341: build failures
vim-patch:8.2.1551: Vim9: error for argument type does not mention the number
vim-patch:8.2.2630: hard to see where a test gets stuck
vim-patch:8.2.4350: FEAT_GUI_ENABLED defined but never used
vim-patch:9.0.2085: Vim9: abstract can be used in interface
vim-patch:9.1.1037: Vim9: confusing error when using abstract method via super
vim-patch:9.1.1586: Vim9: can define an enum/interface in a function
vim-patch:9.1.2076: tests: MinGW test fails midway and stops
vim-patch:9.2.0922: Wayland: modeless selection not redrawn
vim-patch:a6be0d496 CI: Add Github runner for Cygwin
vim-patch:9.2.0924: tests: Test_termwinscroll() fails on FreeBSD
vim-patch:081786261 CI: Bump github/codeql-action

vim-patch:8.1.1851: crash when sound_playfile() callback plays sound

vim-patch:8.2.1527: Vim9: cannot use a function name at script level
vim-patch:8.2.1541: Vim9: cannot find function reference for s:Func
vim-patch:8.2.1581: using line() for global popup window doesn't work
vim-patch:8.2.1582: the channel log does not show typed text
vim-patch:8.2.1592: Vim9: passing "true" to char2nr() fails

vim-patch:9.1.0879: source is not consistently formatted
2026-08-10 03:43:34 -04:00
Jan Edmund Lazo
2450ae797c build(vim-patch): sound feature is n/a (#41257)
Vim core did not leverage it to override/customize bell/beep.
It wasn't used for custom sounds for system/user (autocmd) events.
It should be in-scope for GUI, unlike terminal, even as a plugin
by leveraging some internal option similar to `set guioptions+=!`.

No progress as of Vim 9.2 so I quit.
2026-08-10 04:29:42 +00:00
zeertzjq
2b29905c7f vim-patch:9.2.0927: curswant not set on 8g8 (#41255)
Problem:  curswant not set on 8g8
Solution: Set curswant, adjust tests (Emilien Breton)

closes: vim/vim#20979

7fe5cb35f9

Co-authored-by: Emilien Breton <bricktech2000@gmail.com>
2026-08-10 00:39:14 +00:00
Justin M. Keyes
abc271d8f3 fix(logging): vimscript API calls #41253
Problem:
":call nvim_get_mode()" logs a nonsense channel-id:

    RPC: ch 9223372036854775808: invoke nvim_get_mode

Solution:
Check `is_internal_call`.
Also, skip this logging for RPC calls, because it's redundant with
`log_request`/`log_notify`.

    API: vim -> nvim_get_mode
2026-08-09 17:33:53 -04:00
Jan Edmund Lazo
04f802a2f6 build(vim-patch): n/a patches from comments, ifdefs #41247
vim-patch.sh fails to detect n/a patches
because of ifdef FEAT_ guards and reserved Vim9script error codes.

Ignore all conditional directives for Vim's "FEAT_" guards.
https://cppreference.com/c/preprocessor/conditional
2026-08-09 06:49:05 -04:00
Jan Edmund Lazo
662f983f76 vim-patch:8.2.1475: Vim9: can't use v:true for option flags (#41249)
Problem:    Vim9: can't use v:true for option flags.
Solution:   Add tv_get_bool_chk(). (closes vim/vim#6725)

----

"tv_get_bool_or_number_chk()" without vim9 params is identical to
"tv_get_number_chk()".
"tv_get_number_chk()" and tv"_get_bool_chk()" are identical
after excluding new vim9 params.
Yes, "want_bool" param is N/A because of "in_vim9script()".
If I port it, then I will refactor these macros or "static inline"
functions within "src/nvim/eval/typval.h".

----

36967b32fd

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-09 06:53:31 +00:00
zeertzjq
9f600c8914 Merge pull request #41243 from janlazo/vim-8.2.1590
vim-patch:8.2.{1590,1597}
2026-08-09 10:46:01 +08:00
Torben Leth
f538a4f16f vim-patch:9.2.0926: filetype: Business Central files are not recognized (#41230)
Problem:  filetype: Business Central files are not recognized
Solution: Add filetype detection logic for *.al files to detect perl or
          use either perl or al filetype (Torben Leth).

Reference:
https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-dev-overview

closes: vim/vim#20975

Supported by AI.

9b41cf6386
2026-08-09 00:49:20 +00:00
zeertzjq
a45d3dccf1 Merge pull request #41246 from zeertzjq/vim-e0b8113
vim-patch: doc updates
2026-08-09 08:17:43 +08:00
zeertzjq
10aa1c975f vim-patch:a33e5da: runtime(doc): Improve :help expr-number
closes: vim/vim#20956

a33e5da9f5

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-08-09 08:00:12 +08:00
zeertzjq
05acaa8330 vim-patch:e0b8113: runtime(doc): DocBook syntax variable scopes are not clearly documented
Problem:  DocBook syntax variable scopes of docbk_type and docbk_ver
          are not clearly documented: docbk_type uses the wrong scope
          (it should be buffer-local) and docbk_ver also has an
          undocumented buffer-local version.
Solution: Correct the docbk_type examples and describe the docbk_ver
          precedence.

closes: vim/vim#20977

e0b81136c7

Co-authored-by: Bogdan Barbu <l4b.bogdan.barbu@gmail.com>
2026-08-09 08:00:11 +08:00
Jan Edmund Lazo
b3a0cfcd0a vim-patch:8.2.1597: the channel source file is too big
Problem:    The channel source file is too big.
Solution:   Move job related code to a new source file.

----

Move eval-related prompt-buffer API to src/nvim/nvim/eval/buffer.c.

https://github.com/neovim/neovim/pull/37743#issuecomment-3897416840

----

8b5866ded6

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-08 14:52:26 -04:00
Jan Edmund Lazo
9c6ea122a8 vim-patch:8.2.1590: Vim9: bufnr() doesn't take "true" argument
Problem:    Vim9: bufnr() doesn't take "true" argument.
Solution:   use tv_get_bool_chk(). (closes vim/vim#6863)

fe136c9a85

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-08 09:06:53 -04:00
Christian Clason
0faf4aca73 build(deps): bump wasmtime to v36.0.13 2026-08-08 13:50:43 +02:00
Christian Clason
c447b99e40 build(deps): bump tree-sitter to 308aee0c9 2026-08-08 13:50:43 +02:00
Justin M. Keyes
e16d577f16 Merge #41224 from justinmk/fixbuild 2026-08-08 03:59:15 -04:00
Jan Edmund Lazo
a08607b8d6 vim-patch:8.2.1478: Vim9: cannot use "true" for some popup options (#41236)
Problem:    Vim9: cannot use "true" for some popup options.
Solution:   Add dict_get_bool(). (closes vim/vim#6725)

558813314d

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-08 13:19:59 +08:00
zeertzjq
27e36dea19 Merge pull request #41235 from janlazo/vim-8.2.1572
vim-patch:8.2.{1572,1573,1574,1575,1576,1577}
2026-08-08 12:50:25 +08:00
Jan Edmund Lazo
989726f3a6 vim-patch:8.2.1577: Vim9: hasmapto()/mapcheck()/maparg() do nottake "true" arg
Problem:    Vim9: hasmapto(), mapcheck() and maparg() do not take "true" as
            argument.
Solution:   Use tv_get_bool(). (closes vim/vim#6822, closes vim/vim#6824)

04d594b9c1

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-08 00:28:12 -04:00
Jan Edmund Lazo
ecbae9911e vim-patch:8.2.1576: Vim9: index() does not take "true" as argument
Problem:    Vim9: index() does not take "true" as argument.
Solution:   Use tv_get_bool_chk(). (closes vim/vim#6823)

6c553f9c04

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-08 00:25:18 -04:00
Jan Edmund Lazo
b055504d41 vim-patch:8.2.1575: Vim9: globpath() doesnot take "true" as argument
Problem:    Vim9: globpath() doesnot take "true" as argument.
Solution:   Use tv_get_bool_chk(). (closes vim/vim#6821)

f966ce5ea2

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-08 00:23:16 -04:00
Jan Edmund Lazo
f3491ac971 vim-patch:8.2.1574: Vim9: glob() doesnot take "true" as argument
Problem:    Vim9: glob() doesnot take "true" as argument.
Solution:   Use tv_get_bool_chk(). (closes vim/vim#6821)

5892ea1511

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-08 00:22:02 -04:00
Jan Edmund Lazo
c2f0c2b4d1 vim-patch:8.2.1573: Vim9: getreg() does not take "true" as argument
Problem:    Vim9: getreg() does not take "true" as argument.
Solution:   Use tv_get_bool_chk().  (closes vim/vim#6820)

67ff97ded7

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-08 00:19:53 -04:00
Jan Edmund Lazo
e4a96c16c9 vim-patch:8.2.1572: Vim9: expand() does not take "true" as argument
Problem:    Vim9: expand() does not take "true" as argument.
Solution:   Use tv_get_bool_chk().  (closes vim/vim#6819)

551d25e765

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-08 00:16:29 -04:00
zeertzjq
390e90bba4 vim-patch:9.2.0925: crash when getcompletiontype() gets a NULL string (#41231)
Problem:  Crash when getcompletiontype()/getcompletion() gets a NULL string
          (dvaave2025).
Solution: Do not write the NUL terminator in set_cmd_context() when the
          cursor column is at or past the end of the string, since the
          string may be a read-only literal.

fixes:  vim/vim#20963
closes: vim/vim#20964

Supported by AI.

e2dcefa0d8

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-08-08 09:44:54 +08:00
zeertzjq
5d5b8e3e7d vim-patch:9.2.0923: tabpage: closing a tab page loses the alternate tab page (#41229)
Problem:  Closing the current tab page resets the alternate tab page, even
          when that is another tab page which still exists, so that
          CTRL-Tab stops working (igorlfs).
Solution: Restore the last used tab page after entering another one to
          close the current one (Hirohito Higashi).

related: vim/vim#20965
closes:  vim/vim#20973

a05bd64c1d

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-08 09:30:03 +08:00
zeertzjq
318d6a7f59 vim-patch:2c0318d: runtime(doc): fix typo in netrw help file (#41228)
closes: vim/vim#20968

2c0318d285

Co-authored-by: Rochish Manda <28740792+Rochish-Manda@users.noreply.github.com>
2026-08-08 09:26:00 +08:00
Justin M. Keyes
9e283f273b test(terminal): unreliable "spawns in CWD effective at time of invocation"
FAILED  …/terminal/ex_terminal_spec.lua @ 270: :terminal (fake shell) spawns in CWD effective at time of invocation
    Expected values to differ.
    Value:
    "~/work/neovim/neovim/build/Xtest_xdg_terminal"
    stack traceback:
   …/terminal/ex_terminal_spec.lua:276: in function <…/terminal/ex_terminal_spec.lua:270>
2026-08-08 02:23:55 +02:00
Justin M. Keyes
eecc4b73ff fix(coverity): UNINIT, FORWARD_NULL
CID 652778:         Uninitialized variables  (UNINIT)
    /src/nvim/context.c: 353             in ctx_dirs_save()
    347         if (curbuf->b_sfname != NULL && curbuf->b_fname == curbuf->b_sfname) {
    348           cs->cs_save_sfname = xstrdup(curbuf->b_sfname);
    349         }
    350         do_autochdir();
    351         char autocwd[MAXPATHL];
    352         if (os_dirname(autocwd, MAXPATHL) == OK) {
    >>>     CID 652778:         Uninitialized variables  (UNINIT)
    >>>     Using uninitialized value "*cwd" when calling "strcmp".
    353           cs->cs_apply_acd = strcmp(cwd, autocwd) == 0;
    354         }
    355       }
    356     }
    357
    358     /// Restores the dir state saved by ctx_dirs_save(), undoing any chdir made while switched. The

    CID 652777:         Null pointer dereferences  (FORWARD_NULL)
    /src/nvim/context.c: 556             in ctx_switch()
    550         cs->cs_target_win = wp->handle;
    551         cs->cs_target_old_pos = wp->w_cursor;
    552       }
    553       // The CWD-state snapshot is only for a real window target; hidden-buffer target is handled by the
    554       // ctx_win machinery (ctx_win_prep).
    555       if (buf == NULL || wp != NULL) {
    >>>     CID 652777:         Null pointer dereferences  (FORWARD_NULL)
    >>>     Passing null pointer "wp" to "ctx_dirs_save", which dereferences it.
    556         ctx_dirs_save(cs, wp, tp == NULL ? curtab : tp, buf);
    557       }
    558
    559       // Save the current state.
    560       cs->cs_curwin = curwin->handle;
    561       cs->cs_prevwin = prevwin == NULL ? 0 : prevwin->handle;
2026-08-08 02:23:55 +02:00
tao
f0a0182285 refactor(path): pathcmp() #41035
Problem:
Redudant code

Solution:
Add `path_fold_char()` to normalize path sep.
Refactor `pathcmp()` and `path_fnamencmp()` into `path_cmp`.

| feature                  | pathcmp        | path_fnamencmp | path_cmp(now) |
| ------------------------ | -------------- | -------------- | ------------- |
| case folding             | `mb_toupper()` | `utf_fold()`   | `utf_fold()`  |
| consults fileignorecase  |              |              | `ic` param    |
| `maxlen`                 |              |              |             |
| `/` == `\`               |              |              |             |
| MSWIN drive letter       |              |              |             |
| sep affects sorting      |              |              |             |
| ignores a trailing slash |              |              |             |

Refactor `path_fnamecmp` and `path_full_compare` into `path_equal`,
with flags controlling "no filesystem" comparison (i.e. `path_cmp`), env
variables expansion, absolute path resolution and filesystem access.
2026-08-07 19:54:29 -04:00
Justin M. Keyes
b53c00b425 fix(progress): ins-compl progress-msg during pum #41226
Problem:
The insert-mode completion progress-message is in "running" state while
the user is selecting an item. That is noisy and unwanted UX; it was
only intended for the "Scanning..." task.

Solution:
End the progress-msg just after `ins_compl_show_statusmsg`.
2026-08-07 22:49:44 +00:00
Justin M. Keyes
33a688f9fe fix(messages): dangling progress-messages #41222
Problem:
Some builtin features emit progress-messages which never "complete".
- On failure, `:write` does not complete the progress-msg it started.
- ins-completion never ends its "Scanning..." message.

Solution:
- `buf_write()` emits "failed" status on failure.
- `ins_compl_stop()` ends the completion one.
2026-08-07 16:10:02 -04:00
Jan Edmund Lazo
8773f85473 vim-patch:8.2.1533: Vim9: error when passing getreginfo() result to setreg() #41216
Problem:    Vim9: error when passing getreginfo() result to setreg().
Solution:   Use dict_get_bool() for "isunnamed". (closes vim/vim#6784)

6a950581da

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-07 16:08:54 -04:00
Justin M. Keyes
d0e8ebbaf3 Merge #41223 from janlazo/vim-8.2.1550
vim-patch:8.2.{1550,1571}
2026-08-07 16:07:20 -04:00
Jan Edmund Lazo
e0cb9004ee vim-patch:8.2.1571: Vim9: count() third argument cannot be "true"
Problem:    Vim9: count() third argument cannot be "true".
Solution:   use tv_get_bool_chk(). (closes vim/vim#6818)

119f557230

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-07 15:34:48 -04:00
Jan Edmund Lazo
906639e34b build(vim-patch): vim9 check_typval_type() is n/a
v8.2.1551
2026-08-07 14:59:37 -04:00
Jan Edmund Lazo
feba594ed3 vim-patch:8.2.1550: Vim9: bufname('%') gives an error
Problem:    Vim9: bufname('%') gives an error.
Solution:   Only give an error for wrong argument type. (closes vim/vim#6807)

02aaad9109

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-07 14:52:34 -04:00
Justin M. Keyes
0a2676e54a fix(messages): :read starts a "bufwrite" progress #41219
Problem:
filemess() treats an empty suffix as "a buffer write is starting", but
readfile() calls it that way too. So ":read" (and ":edit", …) opens a
`nvim.bufwrite "<file>"` progress that is never completed.

Users of e.g. ghostty will see a stuck "progress" spinner.

Solution:
Only `buf_write()` starts the progress, via `filemess_progress()`.
2026-08-07 13:21:17 -04:00
Erdiansyah
59597316a6 fix(cwd): :bcd lost by nvim_win_set_buf, nvim_open_win #41218
Problem:
:bcd (buffer-local directory) is not preserved after
`nvim_open_win` or `nvim_win_set_buf`

Analysis:
set_curbuf() ends with update_cwd(), which falls back to
os_chdir(globaldir) when the target buffer has no b_localdir.

Solution:
Pass kCtxKeepCwd to ctx_switch().
2026-08-07 12:09:22 -04:00
Mike J McGuirk
fe3aa64945 feat(lsp): pass target buffer to reuse_client predicate #41163
Problem: The reuse_client predicate does not pass the target buffer,
preventing decisions from being truly made per buffer.

Solution: Pass the target buffer.
2026-08-07 11:27:19 -04:00