Commit Graph

32643 Commits

Author SHA1 Message Date
Jan Edmund Lazo
e4bbe09dcc vim-patch:8.2.4379: an empty change is reported to a listener
Problem:    An empty change is reported to a listener.
Solution:   Do not report an empty change. (closes vim/vim#9768)  Remove unused
            return value.

55737c2a31

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-10-23 17:08:10 +08:00
Jan Edmund Lazo
b0ed4a3cb8 vim-patch:8.2.3795: too many #ifdefs
Problem:    Too many #ifdefs.
Solution:   Graduate the jumplist feature.

739f13a55b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-10-23 17:08:10 +08:00
Jan Edmund Lazo
b6dd8bbca0 vim-patch:8.1.2008: error for invalid range when using listener and undo
Problem:    Error for invalid range when using listener and undo. (Paul Jolly)
Solution:   Do not change the cursor before the lines are restored.
            (closes vim/vim#4908)

4544bd2f24

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-10-23 17:08:10 +08:00
zeertzjq
48bd343678 Merge pull request #36288 from neovim/backport-33721-to-release-0.11
fix(terminal): remove condition that buf is curbuf
2025-10-23 17:07:51 +08:00
Gregory Anders
b21ec366b9 fix(terminal): remove condition that buf is curbuf (#33721)
(cherry picked from commit 99e754ae02)
2025-10-23 08:45:03 +00:00
Jan Edmund Lazo
03f9df8117 vim-patch:8.2.0115: byte2line() does not work correctly with text properties
Problem:    Byte2line() does not work correctly with text properties. (Billie
            Cleek)
Solution:   Take the bytes of the text properties into account.
            (closes vim/vim#5334)

9df53b62de

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit 7048c36ba8)
2025-10-23 07:22:16 +00:00
Jan Edmund Lazo
7159a0192b vim-patch:8.1.1711: listener callback called at the wrong moment
Problem:    Listener callback called at the wrong moment
Solution:   Invoke listeners before calling ml_delete_int(). (closes vim/vim#4657)

acf7544cf6

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit 750c350be8)
2025-10-23 07:22:16 +00:00
Jan Edmund Lazo
d573ffcfc7 vim-patch:8.1.1700: listener callback called for the wrong buffer
Problem:    Listener callback called for the wrong buffer.
Solution:   Invoke listeners before calling ml_append_int().

250e3112c6

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit c9b35360ac)
2025-10-23 07:22:16 +00:00
Jan Edmund Lazo
a0dac399d0 vim-patch:8.1.1681: insert stray "{" when listener gets buffer line
Problem:    Insert stray "{" when listener gets buffer line. (Paul Jolly)
Solution:   Flush the cached line after invoking listeners. (closes vim/vim#4455)

0fb286e82d

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit 83f38800e7)
2025-10-23 07:22:16 +00:00
Jan Edmund Lazo
c2a3838ab2 vim-patch:8.1.0636: line2byte() gives wrong values with text properties
Problem:    line2byte() gives wrong values with text properties. (Bjorn Linse)
Solution:   Compute byte offsets differently when text properties were added.
            (closes vim/vim#3718)

b413d2e6a8

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit 36fc266e86)
2025-10-23 07:22:16 +00:00
zeertzjq
4cc060bf44 fix(statusline): redraw if Visual selection other end changes (#36281)
(cherry picked from commit af0f7b59b1)
2025-10-23 04:22:47 +00:00
Robert
a215da823f docs(vimfn): getcwd() behavior #36222
(cherry picked from commit cf48741227)
2025-10-21 22:29:34 +00:00
Matthieu Coudron
f9cad88d5a feat(vimscript): log function name in "fast" message #32616
(cherry picked from commit e42050f4ae)
2025-10-21 15:17:01 +00:00
Riley Bruins
a7eb110098 fix(lsp): noisy log message when enabling server without config #36264
This warning doesn't really make sense, since the `enable()` call is
meant to be run before the `lsp.config` calls. It will be logged many
times (once for each enabled LSP) at startup.

This is especially annoying because calling `enable()` after
configuration causes the first opened buffer not to have its filetype
set in some situations. This is a separate bug which really needs to be
fixed, and makes this superfluous logging more likely.

(cherry picked from commit 3c4acc0f1a)
2025-10-21 14:49:44 +00:00
zeertzjq
a4319015ee vim-patch:9.1.1868: v:register is wrong in v_: command (#36238)
Problem:  v:register is wrong in v_: command (after 9.1.1858).
Solution: Don't reset v:register for OP_COLON (zeertzjq)

related: https://github.com/vim/vim/pull/18583#issuecomment-3418030021

closes: vim/vim#18597

0124320c97

While at it, also fix using stale set_prevcount value. That only matters
when readbuf1 ends with an operator or a register, which never happens,
but it's still good to avoid using a stale value.

(cherry picked from commit 68a54bfda6)
2025-10-18 15:44:11 +00:00
zeertzjq
ad172eb762 vim-patch:9.1.1858: v:register not reset after Visual mode command (#36215)
Problem:  v:register not reset after Visual mode command.
          (laktak)
Solution: Reset v:register if Visual mode was active before
          do_pending_operator() (zeertzjq)

fixes: vim/vim#18579
related: vim/vim#5305
closes: vim/vim#18583

b3b47e540d
(cherry picked from commit aeeadddac4)
2025-10-17 01:17:23 +00:00
Justin M. Keyes
f93747ee3a revert "fix(lsp): _get_workspace_folders does not handle root_dir() function"
This reverts commit 21540d21ca.
2025-10-14 22:31:49 -04:00
Justin M. Keyes
2668a46902 fix(lsp): "attempt to index nil config" #36189
Problem:
If a client doesn't have a config then an error may be thrown.
Probably caused by: 2f78ff816b

    Lua callback: …/lsp.lua:442: attempt to index local 'config' (a nil value)
    stack traceback:
            …/lsp.lua:442: in function 'can_start'
            …/lsp.lua:479: in function 'lsp_enable_callback'
            …/lsp.lua:566: in function <…/lsp.lua:565>

Solution:
Not all clients necessarily have configs.
- Handle `config=nil` in `can_start`.
- If user "enables" an invalid name that happens to match a *client*
  name, don't auto-detach the client.

(cherry picked from commit bf4710d8c3)
2025-10-15 01:15:13 +00:00
zeertzjq
be94fe3156 Merge pull request #36179 from zeertzjq/backport
fix(clipboard): avoid using stale register width (#36178)
2025-10-14 14:03:16 +08:00
zeertzjq
95cc67538b fix(clipboard): avoid using stale register width (#36178)
Fix #36177
Follow-up to #35038
2025-10-14 13:07:09 +08:00
Justin M. Keyes
21540d21ca fix(lsp): _get_workspace_folders does not handle root_dir() function (#36141)
backport #36071

* fix(lsp): type of root_dir should be annotated with string|fun|nil
* feat(lsp): support root_dir as function in _get_workspace_folders
* feat(lsp): let checkhealth support root_dir() function

Examples:

    vim.lsp: Active Clients ~
    - lua_ls (id: 1)
      - Version: <Unknown>
      - Root directories:
          ~/foo/bar
          ~/dev/neovim

Co-authored-by: atusy <30277794+atusy@users.noreply.github.com>
2025-10-12 01:25:54 +00:00
Till Bungert
4e4428dee8 fix: vim.lsp.omnifunc should not throw away other items #35346
(cherry picked from commit 28157738e3)
2025-10-11 20:03:40 +00:00
Sean Dewar
86b2c0f201 fix(float): crash from nasty :fclose autocmds (#36137)
Problem: :fclose may crash Nvim if autocommands close floats prematurely.
Alternatively, :fclose may call win_close for windows not in curtab if
autocommands change curtab or move windows between tab pages via
nvim_win_set_config (may not crash, but is wrong).

Solution: check win_valid before calling win_close.

(cherry picked from commit 3ccba4cdff)

Backports #36134.
2025-10-11 17:37:03 +00:00
Vlad
5c583a8616 test(plugin/shada_spec): always use UTC formatted date (#36128)
Problem

Similar to https://github.com/neovim/neovim/pull/33257, but for the date
component. When timezone is behind UTC the epoch date of individual
components mismatch causing the test to fail.

Solution

The `epoch` variable is created using `os.date` with a `!`, which means
format the date in UTC instead of local timezone:
https://www.lua.org/manual/5.1/manual.html#pdf-os.date.

Since the individual components like year, month, and day are expected
to match `epoch` they should all be created using a `!` as well.

(cherry picked from commit f0b9232ad8)
2025-10-11 07:06:11 +00:00
Vlad
4338eea269 fix(rpc): handle more cases when identifying loopback #36100
Problem:

On MacOS it is a relatively common pattern to set XDG_RUNTIME_DIR under
`/tmp` or `/var`. Both of these are symlinks to `/private/tmp` and
`/private/var`. When checking for loopback the input address is
normalized using `fix_fname`, however this is not applied to the
addresses of the sockets. As a result of one address being normalized
and the other not the comparison would fail.

Solution:

Normalize both sides of the comparison using `fix_fname`.

(cherry picked from commit abd0c882b3)
2025-10-10 01:30:32 +00:00
zeertzjq
aab8134f87 vim-patch:9.1.1839: Window may have wrong height if resized from another tabpage (#36093)
Problem:  Window may have wrong height if resized from another tabpage.
Solution: Improve check for whether a tabline has been added (zeertzjq).

fixes: vim/vim#18518
closes: vim/vim#18519

bd3b958027
(cherry picked from commit 28355050a8)
2025-10-09 00:23:32 +00:00
Sean Dewar
f2fb46ef9e fix(api): nvim_open_win default to half-size for splits (#36088)
Problem: after #35601, nvim_open_win incorrectly attempts to set the size of a
split window to 0 if it wasn't specified.

Solution: only attempt to set the size again if it was actually specified. This has the effect of defaulting to half the size of the parent window (or it may be equalized with other windows to make room), like before.

Fix #36080

(cherry picked from commit d7472c0617)
2025-10-08 16:56:29 +00:00
zeertzjq
816273ae94 test: add a test for #36059
(cherry picked from commit b9482a0a26)
2025-10-08 00:51:46 +00:00
zeertzjq
d21c23b8c9 vim-patch:9.1.1836: 'culopt' "screenline" not redrawn with line("w0") and :retab
Problem:  'cursorlineopt' "screenline" isn't redrawn when moving cursor
          and then using line("w0") and :retab that does nothing.
Solution: Call redraw_for_cursorcolumn() when setting a valid w_virtcol
          (zeertzjq).

closes: vim/vim#18506

a084914361
(cherry picked from commit ba47cb7eda)
2025-10-08 00:51:46 +00:00
Sean Dewar
e1fe0ed2df vim-patch:9.1.1831: stray vseps in right-most 'winfixwidth' window
Problem:  vertical separator of 'winfixwidth' windows may remain if they
          become right-most windows from closing windows to the right.
Solution: Don't implicitly rely on frame_new_width to fix vseps, as the
          call may be skipped for 'winfixwidth' windows to preserve
          their width; do it explicitly in winframe_remove (Sean Dewar).

Note that I prefer win_new_width here over setting w_width directly, which
would've previously been done by win_split_ins after frame_add_vsep, as this
wasn't true for winframe_remove.

Though the equivalent issue of bottom 'winfixheight' windows leaving stray
statuslines with &ls=0 doesn't seem to exist, test it anyway.

closes: vim/vim#18481

620c655677

Nvim: calling win_new_width over setting w_width directly is especially
important in making sure stuff like w_view_width is correct here.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
(cherry picked from commit 7923e847ca)
2025-10-05 23:13:59 +00:00
zeertzjq
7304fc275e fix(excmd): :trust executed even when inside false condition (#36032)
Problem:  :trust is executed even when inside false condition.
Solution: Make skip_cmd() return true for CMD_trust, as ex_trust() does
          not handle eap->skip itself.
(cherry picked from commit 2f35221774)
2025-10-05 03:00:48 +00:00
zeertzjq
9ce88d5cb9 Merge pull request #36022 from zeertzjq/backport
vim-patch:9.1.1823: diff: w_topline may be invalidated (#36018)
2025-10-04 20:40:38 +08:00
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