Commit Graph

9595 Commits

Author SHA1 Message Date
Sean Dewar
d1189ea508 fix(window): win_move_after UAF from naughty autocmds (#37065)
Problem: use-after-free in win_move_after if win_enter autocommands free win1/2.
Solution: set w_pos_changed before calling win_enter.
2025-12-21 20:31:05 +00:00
Sean Dewar
a2b9720939 fix(api): open_win leak from naughty autocommands
Problem: error set by win_set_buf may leak if autocommands immediately close the
new window.

Solution: free the error set by win_set_buf. (prefer nvim_open_win's error as
it's more important and will cause 0 to be returned)
2025-12-21 15:35:30 +00:00
Sean Dewar
d788864cde fix(api): ignore split_disallowed when opening a float
Problem: split_disallowed seemingly exists to prevent issues from changing
frames to accomodate a split window, which doesn't apply to floats.

Solution: remove the restriction for nvim_open_win, but only for floats.
(continue to check b_locked_split though)

NOTE: like before, the buffer we check b_locked_split for may not actually be
the target buffer "buf", as the later call to win_set_buf can fail to switch to
"buf" due to autocommands. (among other things)

Maybe we could attempt to close the new window in that case (or switch to a
different buffer if that also fails), but this is safer. (and simpler)

Fixes #36857 (and possibly some spurious E242s I've observed from extui)
2025-12-21 15:35:30 +00:00
Justin M. Keyes
0d206da461 Merge #37057 docs 2025-12-21 00:22:36 -05:00
Olivia Kinnear
ad330e99d1 fix(statusline): diagnostics spacing #36897 2025-12-20 23:58:38 -05:00
Justin M. Keyes
060993e438 docs: misc, lsp 2025-12-20 22:07:27 -05:00
zeertzjq
f89558848b vim-patch:9.1.2001: cursor may end up in wrong window after :botright copen (#37056)
Problem:  After :botright copen and closing the quikfix window, the
          cursor ends up in the wrong window. The problem is fr_child
          always points to the first (leftmost for FR_ROW, topmost for
          FR_COL) child frame. When do :vsplit, the new window is
          created on the left, and frame_insert() updates the parent's
          fr_child to point to this new left window.
Solution: Create a snapshot before open the quickfix window and restore
          it when close it (glepnir).

closes: vim/vim#18961

b43f9ded7e

Co-authored-by: glepnir <glephunter@gmail.com>
2025-12-21 10:41:53 +08:00
Justin M. Keyes
81e2d2ea53 Merge #37033 from justinmk/testdelay 2025-12-20 19:52:40 -05:00
Bryan Turns
bef68ba266 docs(lua): iInconsistent vim.keymap param name #37026
Problem: vim.keymap.del has 'modes' as it's first argument while vim.keymap.set
has 'mode' as it's first argument despite both 'mode' and 'modes' taking in the
same type input of String or String[].

Solution: Updated vim.keymap.set docs to refer to it's first argument
as 'modes'.
2025-12-20 19:26:44 -05:00
Justin M. Keyes
2eb11f21eb test(messages): skip os_delay during tests
Problem:
Tests that trigger `os_delay` messages may take 1-3 seconds, wasting
build/CI time, since this serves no purpose in tests.

Solution:
- Introduce `msg_delay` for cases where `os_delay` is being used as
  a "UI feature".
- Skip `msg_delay` in tests.
2025-12-20 18:38:11 -05:00
zeertzjq
f15c28ed7a vim-patch:8.2.3766: converting a funcref to a string leaves out "g:"
Problem:    Converting a funcref to a string leaves out "g:", causing the
            meaning of the name depending on the context.
Solution:   Prepend "g:" for a global function.

c4ec338fb8

Co-authored-by: Bram Moolenaar <Bram@vim.org>
Co-authored-by: Jan Edmund Lazo <jan.lazo@mail.utoronto.ca>
2025-12-20 09:45:47 +08:00
Sean Dewar
eac2f0443e feat(tag): respect jumpoptions=view when popping tagstack (#37021)
Problem: jumpoptions=view has no effect when popping from the tagstack.
Solution: make it work.
2025-12-19 23:32:09 +00:00
zeertzjq
2860d1e018 vim-patch:9.1.1998: tests: not enough tests for :setlocal omnifunc (#37023)
Problem:  Not enough tests for :setlocal omnifunc (after 9.1.1991).
Solution: Move the last :new after :setlocal. Also test with 'complete'
          (zeertzjq).

closes: vim/vim#18958

cedb1a3171
2025-12-19 08:08:26 +08:00
zeertzjq
c08139d790 fix(lua): don't remove first char of non-file stacktrace source (#37008) 2025-12-18 08:09:16 +08:00
zeertzjq
c172fd9f46 vim-patch:9.1.1991: :setlocal changes effective global 'omnifunc' (#37013)
Problem:  :setlocal changes effective global 'omnifunc' (Maxim Kim)
Solution: Don't change global callback when using :setlocal (zeertzjq).

fixes:  vim/vim#18948
closes: vim/vim#18951

3e82b0ebfe
2025-12-17 23:26:42 +00:00
glepnir
856391bc7f fix(health): "q" keymap not set when health.style=float #37007
Problem:
The q keymap is already set in open_floating_preview, so maparg('q') is not empty.

Solution:
Add a health.style check before setting the q keymap.
2025-12-17 10:53:08 -05:00
Jan Edmund Lazo
1b1a8895bd vim-patch:8.2.1941: Ex mode test fails on MS-Windows with GUI
Problem:    Ex mode test fails on MS-Windows with GUI.
Solution:   Skip the test when using gvim.

399db046ed

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-17 00:47:13 -05:00
Jan Edmund Lazo
d6607dae41 vim-patch:8.2.1939: invalid memory access in Ex mode with global command
Problem:    Invalid memory access in Ex mode with global command.
Solution:   Make sure the cursor is on a valid line. (closes vim/vim#7238)

3b6d57f2ce

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-17 00:46:41 -05:00
glepnir
0197f13ed4 fix(lsp): sort items when completeopt include fuzzy #36974
Problem: When fuzzy is enabled and the prefix is not empty,
items are not sorted by fuzzy score before calling fn.complete.

Solution: Use matchfuzzypos to get the scores and sort the items
by fuzzy score before calling fn.complete.
2025-12-16 22:39:47 -05:00
zeertzjq
544bde3acc vim-patch:9.1.1987: assert_equal() prepends unnecessary ':' when typed
Problem:  assert_equal() prepends unnecessary ':' when typed
          (after 9.0.1758).
Solution: Don't change a NULL stacktrace to an empty string (zeertzjq).

closes: vim/vim#18936

c4b3aefd0d
2025-12-17 06:47:34 +08:00
Olivia Kinnear
bd225422a5 fix(lsp): tests for :lsp, rename start/stop
- Rename :lsp start/stop to enable/disable
- Move lua section of `:lsp` to `vim/_core`
- Add tests
2025-12-16 13:46:08 -05:00
brianhuster
63abb1a88f feat(lsp): builtin :lsp command
Problem:
- Despite [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)
  claims to be a "data-only" plugin, in fact it still provides some
  user-facing commands because they haven't been upstreamed to Nvim.

Solution:
- Upstream `:LspRestart`, `:LspStart` and `:LspStop` commands as `:lsp
  restart`, `:lsp start` and `:lsp stop` respectively.

Co-authored-by: glepnir <glephunter@gmail.com>
2025-12-16 13:46:04 -05:00
glepnir
6af8958055 fix(highlight): respect 'winhighlight' in CursorLine Normal check #36927
Problem:
CursorLine background check used global `normal_bg`, ignoring 'winhighlight'.

Solution:
Use `bg_attr` to get window-local Normal background instead.
2025-12-16 00:51:54 -05:00
Justin M. Keyes
9b768d6b3d Merge #36860 from justinmk/doc2 2025-12-15 23:10:33 -05:00
zeertzjq
7a866e6b20 vim-patch:9.1.1981: tests: test suite may stop on error in gen_opt_test.vim (#36988)
Problem:  tests: test suite may stop on error in gen_opt_test.vim
Solution: Use a different output file for log files (Muraoka Taro)

When running newtests, it may unexpectedly stop just before
test_options_all.

Cause: When generating the opt_test.vim file for test_options_all, the
failure is detected by the existence of test.log. Therefore, if a test
performed before test_options_all fails and test.log is created, it is
mistakenly thought that the generation of opt_tet.vim has failed, and
the test suite stops there.

So let's change the filename created when utils/gen_opt_test.vim fails
from test.log to gen_opt_test.log, so that it can be detected
independently from other test failures.

closes: vim/vim#18928

35de719c0c

Co-authored-by: MURAOKA Taro <koron.kaoriya@gmail.com>
2025-12-16 07:50:02 +08:00
Ayaan
53aad276b6 fix(messages): exclude "search hit BOTTOM" msg from history #36961
Problem:
:messages history include the "search hit BOTTOM, continuing at TOP" message,
which is noise.

Solution:
Set msg_hist_off before giving the warning and reset it after warning.
2025-12-15 14:01:27 -05:00
Justin M. Keyes
31dfecb458 docs: misc, editorconfig
fix https://github.com/neovim/neovim/issues/36858
2025-12-15 13:55:15 -05:00
Tristan Knight
8165427b4d fix(lsp): correct capability checks for dynamic registration (#36932)
Refactor capability checks in Client:_supports_registration and
Client:supports_method to properly handle dynamicRegistration and unknown
methods. Now, dynamic capabilities are checked before assuming support for
unknown methods, ensuring more accurate LSP feature detection.
2025-12-15 13:23:57 -05:00
glepnir
e265cc28f9 refactor(test): deprecates functions in some tests #36972
Problem: feed_command, nvim_buf_set_option, nvim_buf_get_number, and exc_exec
are marked as deprecated.

Solution: Remove them from the test units in api/buffer_spec, autocmd/focus_spec,
ui/input_spec, and editor/put_spec.

Some test units only used a few deprecated functions, so creating a separate PR
for each would be excessive. Therefore, several were combined into a single PR.
2025-12-15 10:58:24 -05:00
glepnir
df849f6541 refactor(test): use command, pcall_err in num_options_spec #36933
Problem: feed_command is marked as deprecated, and validating error messages
is a bit verbose.

Solution: use command and pcall_err with matches
2025-12-15 02:13:58 -05:00
glepnir
86a4588d4a test: remove feed_command in undo_spec #36953
Problem: feed_command is marked as deprecated.

Solution: replace it with command and pcall_err.
2025-12-15 02:11:23 -05:00
Riley Bruins
976a47e81b Revert "refactor(treesitter): use scratch buffer for string parser" #36964
This reverts commit 2a7cb32959.
2025-12-15 02:09:36 -05:00
zeertzjq
2700f6642a fix(buffer): switching buffer should respect jumpoptions+=view (#36969)
Also add missing change to buflist_findfmark() from #19224.
2025-12-15 14:45:11 +08:00
zeertzjq
f494ce77f1 vim-patch:9.1.1978: tests: Test_smoothscroll_number() may fail (#36965)
Problem:  tests: Test_smoothscroll_number() may fail because of
          'showcmd'
Solution: Send redraw command (Hirohito Higashi)

closes: vim/vim#18921

5193375b10

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-12-15 01:06:13 +00:00
zeertzjq
f5e39560ff vim-patch:9.1.1980: filetype: N-Quads files are not recognized (#36967)
Problem:  filetype: N-Quads files are not recognized
Solution: Detect *.nq files as nq filetype

Reference:
- https://www.w3.org/TR/n-quads/

closes: vim/vim#18923

6c027b25f1

Co-authored-by: Gordian Dziwis <gordian@dziw.is>
2025-12-15 00:55:41 +00:00
zeertzjq
3985257496 vim-patch:9.1.1979: :helpclose allows range and counts (#36966)
Problem:  :helpclose incorrectly accepts a range and a count.
Solution: Remove EX_COUNT and EX_RANGE from the command definition.
          (Doug Kearns)

closes: vim/vim#18917

4c141bae3b

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-12-15 08:38:42 +08:00
Jaehwang Jung
63737e6e73 fix(treesitter): no injection highlighting on last line #36951
Problem:
If the last visible line in a window is not fully displayed, this line
may not get injection highlighting. This happens because line('w$')
actually means the last *completely displayed* line.

Solution:
Use line('w$') + 1 for the botline.

This reverts 4244a96774
"test: fix failing lsp/utils_spec #36609",
which changed the test based on the wrong behavior.
2025-12-14 19:01:49 -05:00
zeertzjq
592582ba48 fix(input): don't exit on EOF when peeking for input with -es (#36948)
Only exit on EOF when doing a blocking wait for input.
2025-12-15 08:00:40 +08:00
Jan Edmund Lazo
7ce17cd2a2 vim-patch:8.2.4529: Vim9: comparing partial with function fails
Problem:    Vim9: comparing partial with function fails.
Solution:   Support this comparison.  Avoid a crash. (closes vim/vim#9909)
            Add more test cases.

ed0c62e7b1

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-14 10:58:53 -05:00
Jan Edmund Lazo
2c560d8544 vim-patch:9.0.0025: accessing beyond allocated memory with the cmdline window
Problem:    Accessing beyond allocated memory when using the cmdline window in
            Ex mode.
Solution:   Use "*" instead of "'<,'>" for Visual mode.

c6fdb15d42

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-13 21:08:10 -05:00
Jan Edmund Lazo
cd543d618d vim-patch:8.2.4763: using invalid pointer with "V:" in Ex mode
Problem:    Using invalid pointer with "V:" in Ex mode.
Solution:   Correctly handle the command being changed to "+".

f50808ed13

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-13 21:08:10 -05:00
Jan Edmund Lazo
0c70fbf0d6 vim-patch:8.2.4633: Visual range does not work before command modifiers
Problem:    Visual range does not work before command modifiers.
Solution:   Move Visual range to after command modifiers.

c75bca3ee9

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-13 21:02:17 -05:00
zeertzjq
384a039db7 vim-patch:9.1.1974: tests: missing cleanup in Test_bwipe_during_save()
Problem:  tests: missing cleanup in Test_bwipe_during_save().
Solution: Reset &charconvert.

closes: vim/vim#18908

353103e59a
2025-12-12 15:51:06 +08:00
zeertzjq
e9da68effe vim-patch:9.1.1971: Crash when buffer gets deleted inside charconvert during save
Problem:  Crash when buffer gets deleted inside charconvert during save
Solution: Check for `b_saving` inside `can_unload_buffer()`, so we don’t try to
          unload a buffer while it’s still being saved (glepnir).

closes: vim/vim#18901

fe1c57cd2c

Co-authored-by: glepnir <glephunter@gmail.com>
2025-12-12 15:50:44 +08:00
zeertzjq
2b02dfa020 vim-patch:9.1.1970: visual end column returns wrong value after block edit (#36923)
Problem:  visual end column returns wrong value after block edit
Solution: update visual end column after block insert (phanium)

fixes:  vim/vim#18900
closes: vim/vim#18903

fa3bdc2501

Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
2025-12-12 09:38:11 +08:00
zeertzjq
5a83f23430 vim-patch:98a0cbf: patch 9.1.1971: crash with invalid positional argument 0 in printf() (#36919)
Problem:  crash with invalid positional argument 0 in printf()
Solution: Reject positional arguments <= 0.

closes: vim/vim#18898

98a0cbf05b

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-12-12 08:14:58 +08:00
zeertzjq
18642a63be vim-patch:9.1.1969: Wrong cursor position after formatting with long 'formatprg' (#36918)
Problem:  Wrong cursor position after formatting with long 'formatprg'.
Solution: Don't show hit-enter prompt when there are stuffed characters.

Previously a stuffed character at the hit-enter prompt will dismiss the
prompt immediately and be put in the typeahead buffer, which leads to
incorrect behavior as the typeahead buffer is processed after the stuff
buffers. Using vungetc() when KeyStuffed is TRUE can fix this problem,
but since the hit-enter prompt isn't visible anyway (and is likely not
desired here), just skip the prompt instead, which also avoids a wait
when using "wait" instead of "hit-enter" in 'messagesopt'.

fixes:  vim/vim#18905
closes: vim/vim#18906

50325c3d59
2025-12-12 08:07:55 +08:00
Jan Edmund Lazo
08eb133c3f vim-patch:8.2.4474: memory allocation failures not tested in quickfix code
Problem:    Memory allocation failures not tested in quickfix code.
Solution:   Add alloc IDs and tests. (Yegappan Lakshmanan, closes vim/vim#9848)

5a2d4a3ecb

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-12-10 21:55:52 -05:00
Jan Edmund Lazo
e31cfc5eac vim-patch:partial:8.2.2400: Vim9: compiled functions are not profiled
Problem:    Vim9: compiled functions are not profiled.
Solution:   Add initial changes to profile compiled functions.  Fix that a
            script-local function was hard to debug.

b204990346

Port only test_profile.vim.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-10 20:28:17 -05:00
Jan Edmund Lazo
1ae7c11392 vim-patch:8.2.2404: Vim9: profiling try/catch not correct
Problem:    Vim9: profiling try/catch not correct.
Solution:   Add profile instructions.  Fix that "entry" did not rethrow an
            excpetion.

107e9cecf7

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-10 20:28:17 -05:00