Commit Graph

32611 Commits

Author SHA1 Message Date
zeertzjq
ac48d9c3c9 vim-patch:9.1.1823: diff: w_topline may be invalidated (#36018)
Problem:  diff: w_topline may be invalidated
Solution: Update lnum in diff_set_topline()
          (Yee Cheng Chin).

This can happen in ex_diffupdate() for certain edge cases which cause
the logic to now be wrong. This was also the root cause for vim/vim#18437 where
Vim would crash due to a null pointer dereferencing (said pointer would
not be null under normal circumstances).

related: vim/vim#18437
closes: vim/vim#18484

dd9ed46a39

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-10-04 20:07:22 +08:00
glepnir
479bb9cbab fix(api): nvim_open_win respects requested split window size (#35601)
Problem: requested window size passed to nvim_open_win for splits may be ignored
by win_split_ins if it decides to forcefully equalize window sizes instead (e.g:
in an attempt to make room for the new window).

Solution: try to set the size again if it differs from what was requested.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-10-04 10:18:48 +01:00
zeertzjq
675fc52183 refactor(terminal): remove an unnecessary xmemdupz() for OSC 8 (#36012)
Instead, NUL-terminate the StringBuilder when needed.
Also deduplicate xmemdup() calls for schedule_termrequest().

(cherry picked from commit 04022c70f3)
2025-10-04 04:02:59 +00:00
zeertzjq
854b319060 fix(terminal): handle OSC 8 split into multiple fragments
Also fix off-by-one size passed to xmemdupz().

(cherry picked from commit 40bf38fefc)
2025-10-04 01:39:29 +00:00
zeertzjq
07184aa973 fix(tui): handle sequence larger than entire buffer
(cherry picked from commit f64475a226)
2025-10-04 01:39:29 +00:00
zeertzjq
2655998a07 Merge pull request #36005 from zeertzjq/backport
test(tui_spec): deduplicate (#36003)
2025-10-03 19:52:34 +08:00
zeertzjq
8173e3ed6b test(tui_spec): deduplicate (#36003) 2025-10-03 19:28:13 +08:00
zeertzjq
53dc08a19b Merge pull request #36000 from zeertzjq/backport
Backport to release-0.11
2025-10-03 17:17:40 +08:00
zeertzjq
dc5566fed5 test(tui_spec): avoid dangling Nvim process on test failure 2025-10-03 16:14:14 +08:00
zeertzjq
2af99811f7 test: remove a few more redundant clear() calls 2025-10-03 16:14:14 +08:00
zeertzjq
0837a1ec2e test: don't call clear() in both before_each() and after_each() 2025-10-03 16:14:14 +08:00
zeertzjq
4923d151b5 test: remove duplicate legacy/{increment,undolevels}_spec.lua
They are almost exact copies of parts of test_{increment,undo}.vim.
2025-10-03 16:14:14 +08:00
zeertzjq
f8aaba8495 test: make error clearer for RPC request after crash 2025-10-03 16:14:14 +08:00
zeertzjq
83a90c530b test: reduce some clear() calls
Use only a single clear() call in some test/functional/vimscript/ test
files whose test cases have very little side effect.

A downside of using a single clear() is that if a crash happens in one
test case, all following test cases in the same file will also fail, but
these functionalities and tests don't change very often.
2025-10-03 16:14:10 +08:00
zeertzjq
61aab4cfe0 vim-patch:9.1.0698: tests: "Untitled" file not removed when running Test_crash1_3 alone
Problem:  tests: "Untitled" file not removed when running Test_crash1_3 alone
          with TEST_FILTER (after v9.1.0695)
Solution: Use a TearDown function instead of another test.
          (zeertzjq)

closes: vim/vim#15578
closes: vim/vim#15577

d56c451e1c
(cherry picked from commit 532cc88604)
2025-10-02 01:51:27 +00:00
zeertzjq
a839200c0a vim-patch:9.1.0695: tests: test_crash leaves Untitled file around
Problem:  tests: test_crash leaves Untitled file around
Solution: cleanup at the end of the test_crash.vim test file

cd83173def

Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit 71662bbb49)
2025-10-02 01:51:27 +00:00
zeertzjq
8634a46165 vim-patch:9.1.0689: [security]: buffer-overflow in do_search() with 'rightleft'
Problem:  buffer-overflow in do_search() with 'rightleft'
          (SuyueGuo)
Solution: after reversing the text (which allocates a new buffer),
          re-calculate the text length

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-v2x2-cjcg-f9jm

cacb6693c1

Add missing change from patch 8.1.1270.
Omit `call delete('Untitled')`: moved again in patch 9.1.0695.

Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit 69a9a25fcc)
2025-10-02 01:51:27 +00:00
zeertzjq
dd79bc8360 vim-patch:014c731: runtime(doc): make :h virtcol() more accurate (#35976)
The current description (especially the "unlimited width" part) is
inaccurate in several ways:
- The size of virtual text can depend on window width. In particular,
  the size of "above" virtual text can be equal to window width.
- A double-width character that doesn't fit adds 1 to the virtual column
  of the following characters.
- The size of 'showbreak' and 'breakindent' is counted.

related: vim/vim#5713
closes: vim/vim#18447

014c731fa5
(cherry picked from commit 43f7434bd5)
2025-10-02 00:07:28 +00:00
zeertzjq
6dda8e9572 vim-patch:9.1.1808: Option insecure flags not copied when splitting window
Problem:  Option insecure flags not copied when splitting window.
Solution: Move window-local insecure flags to winopt_T and copy them
          properly (zeertzjq).

closes: vim/vim#18434

b3740f4b00
(cherry picked from commit 42f1864b62)
2025-09-30 01:04:40 +00:00
zeertzjq
67688ab616 vim-patch:9.1.1807: :set doesn't clear local insecure flag like :setlocal does
Problem:  :set doesn't clear local insecure flag like :setlocal does.
Solution: Also clear the local insecure flag when using :set (zeertzjq).

This applies to local options like 'wrap', 'foldtext' and 'foldexpr',
whose global flags are actually never used.  For global-local options
like 'statusline' the behavior is already correct, so add some tests.

related: vim/vim#18434

fec5586a45
(cherry picked from commit ff564237d2)
2025-09-30 01:04:40 +00:00
zeertzjq
9c09983068 vim-patch:9.1.1802: 'nowrap' in a modeline may hide malicious code (#35946)
Problem:  'nowrap' in a modeline may hide malicious code.
Solution: Forcibly use '>' as 'listchars' "extends" if 'nowrap' was set
          from a modeline (zeertzjq).

Manual `:setlocal nowrap` disables this behavior.  There is a separate
problem with `:set nowrap` that also applies to some other options.

related: vim/vim#18214
related: vim/vim#18399
closes: vim/vim#18425

9d5208a931

Cherry-pick some test_modeline.vim changes from patches 9.0.{0363,0626}.

(cherry picked from commit 0fa0717d4e)
2025-09-30 00:22:52 +00:00
zeertzjq
7280b7027b Merge pull request #35931 from zeertzjq/backport
vim-patch:9.1.1798: Wrong display with 'sms' and long wrapped virt text at EOL (#35930)
2025-09-27 21:59:33 +08:00
zeertzjq
4db62d96bc vim-patch:9.1.1798: Wrong display with 'sms' and long wrapped virt text at EOL (#35930)
Problem:  Wrong display with 'smoothscroll' and long wrapped virtual
          text at EOL.
Solution: Handle w_skipcol inside long wrapped virtual text at EOL
          (zeertzjq).

closes: vim/vim#18408

d9318acc02
2025-09-27 21:30:21 +08:00
zeertzjq
958a5ef2e6 Merge pull request #35922 from zeertzjq/backport
fix(plines): count 'showbreak' in EOL inline virt_text in line size (#35921)
2025-09-26 13:06:58 +08:00
zeertzjq
47f6f21998 fix(plines): count 'showbreak' in EOL inline virt_text in line size (#35921) 2025-09-26 12:11:35 +08:00
zeertzjq
a1b9070754 test(unit): disable JIT when using mocks (#35913)
This fixes the flaky eval/typval_spec.lua tests.

(cherry picked from commit bfa3e111c2)
2025-09-25 22:56:38 +00:00
zeertzjq
7e724dfa2f vim-patch:9.1.1780: mbyte contains overlapping list of utf_classes table (#35869)
Problem:  mbyte contains overlapping list of utf_classes table
Solution: Update table to contain non-overlapping list (Yuta Yamamoto)

closes: vim/vim#18362

9fa8a114b2

Co-authored-by: Yuta Yamamoto <jichael.y.yuta1995@gmail.com>
(cherry picked from commit e887602eb5)
2025-09-22 01:29:26 +00:00
SkrrtBacharach
d8a7c86e73 fix(health): errors in :checkhealth with pyenv-virtualenv #35865
Problem:
pyenv-virtualenv sets a different path for VIRTUAL_ENV than the path to the
python binary it provides, but these paths both symlink to the same file, so
there should be no disparity. The python health-check reports an error, since it
only checks if these paths are equal, not where they point to (resolve to).

Solution:
- Resolve the python symlinks before checking if they are equal.
- Deduplicate some code.

(cherry picked from commit cfe10b4014)
2025-09-21 22:06:55 +00:00
zeertzjq
c84ba83cf1 fix(options): increase t_Co buffer size (#35859)
(cherry picked from commit c2136e3590)
2025-09-21 04:44:30 +00:00
Judit Novak
8e00534b1e fix(health): hard fail on invalid "python-*" bin #35382
Problem:
Scripts named with 'python-…' prefix may not be valid python bins. If
such a script is found in a venv, the Python healthcheck fails hard.

    .venv/python-argcomplete-check-easy-install-script
    .venv/bin/python3.13
    .venv/bin/python

Solution:
- Discard known false-positives such as `python-argcomplete*`.
- Call `health.warn()` instead of `assert()` in `python_exepath()`.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
(cherry picked from commit 6152bcf42e)
2025-09-19 03:50:52 +00:00
zeertzjq
77fe01f200 vim-patch:9.1.1773: Crash in BufLeave after BufUnload closes other windows (#35830)
Problem:  Crash in BufLeave/WinLeave/TabLeave when closing window after
          BufUnload closes all other windows in the tab page.
Solution: Avoid duplicate BufLeave/WinLeave events. Trigger TabLeave
          before removing the buffer (zeertzjq).

related: vim/vim#14166
related: neovim/neovim#33603
closes: vim/vim#18330

0c70820015
(cherry picked from commit c9f6267402)
2025-09-19 00:38:20 +00:00
Tomasz N
556d8d0002 fix(lsp): treat 2-triggers-at-once as "last char wins" #35435
Problem:
If there are 2 language servers with different trigger chars (`-` and
`>`), and a keymap inputs both simultaneously (`->`), then `>` doesn't
trigger. We get completion items from server1 only.

This happens because the `completion_timer` for the `-` trigger is still
pending.

Solution:
If the next character arrived enough quickly (< 25 ms), replace the
existing deferred autotrigger with a new one that matches this later
character.

(cherry picked from commit e69b81ad94)
2025-09-17 23:52:30 +00:00
zeertzjq
eb4837206a fix(lsp): restore Client:stop() force-stopping behavior (#35800)
This fixes a regression from #33796.

I tried for several hours and cannot write a working test for this, but
this does fix the following warning in tests run with ASAN or TSAN:

    -------- Running tests from test/functional/plugin/lsp_spec.lua
    RUN      T4667 LSP server_name specified start_client(), stop_client(): 114.00 ms OK
    RUN      T4668 LSP server_name specified stop_client() also works on client objects: 97.00 ms OK
    RUN      T4669 LSP server_name specified does not reuse an already-stopping client #33616: 31.00 ms OK
    nvim took 2022 milliseconds to exit after last test
    This indicates a likely problem with the test even if it passed!

(cherry picked from commit 4ef5624729)
2025-09-17 02:02:44 +00:00
zeertzjq
d86658f9d9 test(lsp): make async format test work properly (#35794)
Overriding vim.lsp.handlers['textDocument/formatting'] doesn't work here
because fake_lsp_server_setup() uses a table with __index to specify
client handlers, which takes priority over vim.lsp.handlers[], and as a
result the overridden handler is never called, and the test ends before
the vim.wait() even finishes.

Instead, set a global variable from the handler that is actually reached
(by vim.rpcrequest() from client handler), and avoid stopping the event
loop too early.

(cherry picked from commit 8d5476691c)
2025-09-17 00:53:31 +00:00
zeertzjq
777551c599 test(swapfile_preserve_recover_spec): fix flaky test (#35782)
Invoke nvim_get_mode() to ensure that pending input is processed.

(cherry picked from commit 1bafba31f6)
2025-09-16 00:23:35 +00:00
Justin M. Keyes
693772100e feat(help): gx opens help tag in web browser (#35784)
Problem:
`gx` does not work on tags in help buffers to open the documentation of that tag in the browser.

Solution:
Get the `optionlink`, `taglink` and `tag` TS nodes and set extmark "url" property.
`gx` then discovers the extmark "url" and opens it.

Co-authored-by: Yochem van Rosmalen <git@yochem.nl>
2025-09-15 23:30:31 +00:00
zeertzjq
7aea000343 fix(paste): don't use :echo immediately before :redraw (#35773)
- If tick == 0 at the last chunk, the first :echo will print an empty
  string, which isn't really helpful, and may cause :redraw to move
  cursor to the message area for 'showmode'.
- If tick > 0 at the last chunk, there'll be another :echo that prints
  an empty string immediately after the :redraw.

(cherry picked from commit a5d6932686)
2025-09-15 22:42:43 +00:00
zeertzjq
91f050bd28 Merge pull request #35769 from zeertzjq/backport
fix(lua): don't leak handle when vim._watch.watch() fails (#35768)
2025-09-15 12:16:44 +08:00
zeertzjq
7b1ac2080d fix(lua): don't leak handle when vim._watch.watch() fails (#35768)
This fixes the following warning in tests with ASAN or TSAN:

    -------- Running tests from test/functional/lua/watch_spec.lua
    RUN      T4253 vim._watch watch() ignores nonexistent paths: 29.00 ms OK
    nvim took 2006 milliseconds to exit after last test
    This indicates a likely problem with the test even if it passed!
2025-09-15 11:26:27 +08:00
Justin M. Keyes
14e74d98fd fix(lsp): misleading logs in non-applicable filetypes #35749
Problem:
LSP logs show misleading "cannot start" messages when editing a filetype
NOT listed in the `config.filetypes` field.

    [ERROR][2025-09-13 18:55:56] …/runtime//lua/vim/lsp/log.lua:151
    "cannot start cssls due to config error: …/runtime//lua/vim/lsp.lua:423:
    cmd: expected expected function or table with executable command,
    got table: 0x0104701b18. Info: vscode-css-language-server is not executable"

Solution:
- `can_start`: check `config.filetypes` before checking the rest of the
  config.

(cherry picked from commit 2f78ff816b)
2025-09-14 02:25:43 +00:00
zeertzjq
924a8e4238 fix(tui): don't wait for DA1 response when stdin is closed (#35745)
(cherry picked from commit 4a69847df4)
2025-09-13 13:41:24 +00:00
zeertzjq
85e4503f18 vim-patch:9.1.1754: :helptags doesn't skip examples with syntax
Problem:  :helptags doesn't skip examples with syntax
          (Evgeni Chasnovski)
Solution: Check for examples with syntax (zeertzjq).

fixes: vim/vim#18273
closes: vim/vim#18277

6f020cde56
(cherry picked from commit ae588c183f)
2025-09-12 00:40:53 +00:00
zeertzjq
8ed1ef1377 vim-patch:partial:9.0.0323: using common name in tests leads to flaky tests
Problem:    Using common name in tests leads to flaky tests.
Solution:   Rename files and directories to be more specific.

3b0d70f4ff

This includes only test_help.vim changes.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit 50efe61c3c)
2025-09-12 00:40:53 +00:00
zeertzjq
19d58cb2cc vim-patch:a0f37db: runtime(doc): use a single pattern in :h 'incsearch' example (#35721)
related: https://github.com/vim/vim/pull/18262#issuecomment-3277008408
closes: vim/vim#18270

a0f37dbbf4
(cherry picked from commit c06f0970b0)
2025-09-11 23:51:45 +00:00
James McCoy
1c8805e3b2 fix(vim.json): fix truncation of decoded numbers outside lua_Integer's range #35702
PR #34876 expanded the total range of values that cjson considers
valid. However, it didn't address the bigger problem of storing a
`long long` value in a `lua_Integer` (which is typically a typedef for
`ptrdiff_t`).

On 32-bit platforms, this ends up storing an 8-byte number into a 4-byte
variable, truncating the value.

Store the converted value in a temporary `long long` variable so we can
detect the scenario and decode into a `lua_Number`.

(cherry picked from commit da650de277)
2025-09-11 04:18:30 +00:00
zeertzjq
5c6ea43da8 vim-patch:80981e1: runtime(doc): mention 'findfunc' at :h :find (#35697)
fixes: vim/vim#18250
related: vim/vim#18253

80981e1db9

Co-authored-by: Girish Palya <girishji@gmail.com>
(cherry picked from commit 739fc26d77)
2025-09-09 23:51:42 +00:00
James McCoy
42b2dd5abf Merge pull request #35689 from jamessan/backport-35659-to-release-0.11
fix(tests): ignore vector math types
2025-09-08 21:58:55 -04:00
James McCoy
8f05fdbfb3 fix(tests): ignore vector math types
As noted in #34908, the arm unittests fail due to unrecognized types:

    ERROR    test/unit/testutil.lua @ 802: Expressions parser works with &opt
    test/unit/testutil.lua:774: test/unit/testutil.lua:758: (string) '
    test/unit/testutil.lua:288: declaration specifier expected near '__SVFloat32_t''
    exit code: 256

After testing on Debian's arm64 porterbox, the unittests cleanly pass
when ignoring various types defined in
/usr/include/aarch64-linux-gnu/bits/math-vector.h

(cherry picked from commit e702f97518)
2025-09-08 20:30:19 -04:00
Sean Dewar
5aa6257e8c fix(api): win_set_config error message for splitting from a float #35650
Problem: after #34287 nvim_win_set_config no longer errors when attempting to
split from a floating window only if "win" is 0.

Solution: fix the regression, reduce the scope of "parent" and similar checks to
only where it's currently used and add test coverage for the errors.

(cherry picked from commit da39966a3a)
2025-09-08 17:18:48 +00:00
glepnir
0f6a180bcc perf(api): reduce redundant win_find_tabpage calls (#35643)
Problem: `nvim_win_set_config` calls `win_find_tabpage(parent)` with redundant calls

Solution: Cache `parent_tp` early and reuse before window operations.
(cherry picked from commit 14e94f4617)
2025-09-08 16:20:43 +00:00