Commit Graph

7461 Commits

Author SHA1 Message Date
zeertzjq
444e1ffe3e vim-patch:9.1.2028: [security]: Buffer-overflow with incomplete multi-byte chars (#37133)
Problem:  Buffer overflow in buf_write() when converting incomplete
          multi-byte characters (Kevin Goodsell)
Solution: Make the buffer slightly larger

closes: vim/vim#19007

f99de42a9f

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-12-28 00:37:55 +00:00
glepnir
922816877f fix(pum): hide info floating window when insufficient space (#37107)
fix(pum): hide info window when insufficient space

Problem:
1. Info window was displayed even with insufficient space.
2. Tab characters counted as single cells.

Solution:
1. Hide window when space < 10 columns. Will be configurable
   via completepopup width option in the future.
2. Use win_linetabsize over mb_string2cells.
2025-12-27 13:56:34 +00:00
Justin M. Keyes
c03d635a12 Merge #37097 feat(pack)!: improve handling of src change 2025-12-25 23:44:08 -05:00
glepnir
ef0386fe9a fix(pum): adjust info window column offset when scrollbar is present (#37069)
Problem:
When the popupmenu has no border but includes a scrollbar, the info window
column is misaligned due to a missing column offset.

Solution:
Apply a one-column offset to the info window when the popup menu has no border
and a scrollbar is present.
2025-12-26 02:15:55 +00:00
zeertzjq
b7adf8081c test(api/server_requests_spec): fix flaky test (again) (#37100) 2025-12-26 01:27:30 +00:00
Evgeni Chasnovski
0353d33b00 feat(pack)!: change src of installed plugin inside update() in place
Problem: Changing `src` of already installed plugin currently takes
  effect immediately inside `vim.pack.add()` and acts as "delete and
  later fresh install". Although more robust, this might lead to
  unintentional data loss (since plugin is deleted) if the plugin was
  manually modified or the new source is not valid.
  Also this introduces unnecessary differentiation between "change
  `version`" and "change `src`" of already installed plugin.

Solution: Require an explicit `vim.pack.update()` to change plugin's
  source. It is done by conditionally changing `origin` remote of the
  Git repo. The effect does not require update confirmation in order to
  have new changes fetched from the new `src` right away.

  If in the future there are more types of plugins supported (i.e. not
  only Git repos), also do extra work (like delete + install) during
  `vim.pack.update()`.
2025-12-25 12:57:59 +02:00
Sean Dewar
1cde71233f fix(autocmd): skip empty comma-separated patterns properly
Problem: empty comma-separated patterns in an aupat aren't skipped correctly.
Solution: skip consecutive commas in an aupat.

Also simplify the logic.
2025-12-25 00:08:57 +00:00
Sean Dewar
6d2330f50d fix(autocmd): parsing of comma-separated buflocal patterns
Problem: patterns after a buffer-local pattern in a comma-separated aupat are
         ignored.
Solution: ensure pat refers to the original buffer after each pattern, not the
          buflocal_pat buffer, and when printing make sure it's normalized for
          each pattern, not just the first.

Also simplify the logic when printing all autocommands for an event, and ensure
headings aren't repeated for each event when printing autocommands.
2025-12-25 00:08:57 +00:00
zeertzjq
c374d78095 test(ui/inccommand_spec): don't check for transient message (#37078)
The check for v:errmsg is enough.
2025-12-23 08:15:32 +08:00
Jaehwang Jung
033f1123cd fix(marks): wrong line('w$', win) with conceal_lines (#37047)
Background:
Suppose a window has concealed lines, and sets conceallevel>2,
concealcursor="". The concealed lines are displayed if the window is
curwin and the cursor is on the those lines.

Problem:
line('w$', win) switches curwin to win, and then does validate_botline
for curwin. It computes botline assuming the concealed lines displayed,
resulting in a smaller value than the actual botline that the user sees.

Solution:
Evaluate line('w$', win) without switching curwin.
Apply similar changes to other functions that switches curwin.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-12-22 09:03:50 +00:00
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
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
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
c08139d790 fix(lua): don't remove first char of non-file stacktrace source (#37008) 2025-12-18 08:09:16 +08: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
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
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
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
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
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
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
skewb1k
b87bdef2a8 fix(lua): relax vim.wait() timeout validation #36900
Problem:
After bc0635a9fc `vim.wait()` rejects floats
and NaN values.

Solution:
Restore the prior behavior, while still supporting `math.huge`. Update
tests to cover float case.
2025-12-10 09:44:05 -05:00
CompileAndConquer
aeebc51851 fix(grid): assert crash during extreme resize layouts #36847
Problem:
When the terminal shrinks, Neovim tries to recompute the layout and
adjust every window so that the total width matches the new Columns. But
in the scenario of numerous windows split horizontally, there is
not enough space for all of them. The frame width (topframe->fr_width) never
reaches the new Columns value, the logic tries to redistribute this negative
space across child frames, but it triggers the assert.

Solution:
Skip this case in `win_update`.
2025-12-10 00:32:51 -05:00
glepnir
625c59fe5f fix(highlight): Normal-linked groups shouldn't override CursorLine #35026
Problem: CursorLine doesn't consistently highlight text using groups
linked to Normal (e.g., in quickfix, passwd files), while it works
for direct Normal usage.

Solution: Don't let normal background from linked groups override
explicit non-normal backgrounds during attribute combination.
2025-12-09 23:01:27 -05:00
zeertzjq
df9e4a037a fix(eval): 0 should mean current tabpage in gettabvar() (#36891)
This matches the gettabvar() behavior change in Vim 8.1.1218.
2025-12-10 00:53:57 +00:00
skewb1k
bc0635a9fc fix(lua): vim.wait(math.huge) fails #36885
Problem:
`nlua_wait()` uses `luaL_checkinteger()` which doesn't support
`math.huge` since it's double type. On PUC Lua this fails with
'number has no integer representation' error and on LuaJIT this
overflows int.

Solution:
Use `luaL_checknumber()` and handle `math.huge`.
2025-12-09 13:59:06 -05:00
skewb1k
3b6e8e484e fix(float): prevent truncation of title that fits exactly #36880
Problem:
The `over_flow` parameter in `grid_draw_bordertext` always added 1 for
the '<' character. As a result, titles that fit exactly were still
truncated with an unnecessary '<'.

Solution:
Adjust `over_flow` only when the actual overflow is greater than 0.

Fix #36872
2025-12-09 13:37:32 -05:00
zeertzjq
747cf30c37 vim-patch:9.1.1965: q can accidentally start recording at more prompt (#36879)
Problem:  When exiting at the end of the more prompt (at the hit enter
          prompt) by hitting q the recording mode will be started.
          (Jakub Łuczyński)
Solution: Don't add the q key to the typeahead buffer
          in the function wait_return (Bjoern Foersterling)

fixes: vim/vim#2589
closes: vim/vim#18889

ecce3497fa

Co-authored-by: Bjoern Foersterling <bjoern.foersterling@gmail.com>
2025-12-09 22:25:47 +08:00
zeertzjq
5235f3663f vim-patch:9.1.1964: Wrong display when using setline() at hit-enter prompt (#36878)
Problem:  Wrong display when using setline() at hit-enter prompt
          (after 8.2.3204).
Solution: Only skip scrolling for changed lines in top area if it's
          scrolled down due to w_topline change. Also add more testing
          for what 8.2.3204 fixed (zeertzjq).

closes: vim/vim#18887

e72eacceab
2025-12-09 22:25:34 +08:00
Mathias Fußenegger
c5d4050586 Revert "feat(lsp): support version in textDocument/publishDiagnostics #36754" (#36865)
This reverts commit 03d6cf7aae.

See https://github.com/neovim/neovim/pull/36754#issuecomment-3626115697
The change was supposed to avoid showing stale diagnostics but had the
opposite effect.
2025-12-09 13:29:21 +01:00
Justin M. Keyes
3afe0c6740 Merge #36859 refactor: clint.py => clint.lua 2025-12-08 01:58:58 -05:00
glepnir
cb171ee7cb fix(float): tail truncate long title #28387
Problem:
We truncate the title from start, this is somewhat inconsistent
with the way vim works. Usually we use < to truncate and keep
more trailing characters.

Solution:
Keep more trailing characters.
2025-12-08 01:52:07 -05:00
Justin M. Keyes
0bb5bc5557 refactor: clint.py => clint.lua
Problem:
`clint.py` is the last python in our codebase, and beyond that it needs
some cleanup. And it lacks tests, so modifying it can be painful.

Also, we need a way to add ad-hoc lint rules for *Lua*, so it will help
to have our ad-hoc rules for C in the same language (the scripts may
share functions/techniques): https://github.com/neovim/neovim/issues/28372

Solution:
- convert to `clint.lua` (mostly AI-generated, but it now has test
  coverage, unlike `clint.py`)
- drop rules that are no longer needed:
  - "readability/multiline_string"
    - technially still relevant, but very uncommon so doesn't really matter.
  - "--line-length"
    - Not used in the old clint.py, nor the new clint.lua.
  - "comment whitespace" check
    - It is enforced by uncrustify.
  - "TODO" check
    - The `-google-readability-function-size` clang-tidy rule enforces
      "TODO(user)" format. (It was already enabled long ago.)
2025-12-08 01:43:02 -05:00
zeertzjq
647f11e6ae vim-patch:9.1.1958: Wrong display with sign_unplace() and setline() in CursorMoved (#36851)
Problem:  Wrong display when scrolling with 'scrolloff' and calling
          sign_unplace() and setline() in CursorMoved (after 8.2.3204).
Solution: Still scroll for changed lines below the top area when the top
          is scrolled down (zeertzjq)

closes: vim/vim#18878

2da433cff7
2025-12-08 09:24:26 +08:00