Commit Graph

32640 Commits

Author SHA1 Message Date
f5b5f2095e refactor(tests): lint decorations_spec, float_spec, multigrid_spec #33274
Problem:
decorations_spec.lua, float_spec.lua, multigrid_spec.lua are not
auto-formatted.

Solution:
Add a special `formatlua2` cmake target, which invokes `stylua` with
an alternative `.stylua2.toml` config.
2025-05-06 18:00:20 -07:00
a81d2b6703 docs(luv): replace bundled LuaCATS meta files with upstream
Synced from https://github.com/luvit/luv/blob/master/meta.lua
2025-05-06 18:47:33 +02:00
8707ec2644 fix(termkey): out-of-bounds write in array #33868
Problem:
termkey crashes due to an out-of-bounds write in an array when it
received a CSI sequence with 17 or more arguments. This could be
observed on startup with certain terminal emulators like [RLogin], which
send a response to the `CSI c` query containing 17 parameters.

The termkey code has a boundary check, but its comparison operator is
incorrect.

Solution:
Correct the comparison operator to ensure proper boundary checking.

With this change, I have confirmed that the crash no longer occurs on
RLogin. https://github.com/kmiya-culti/RLogin

Fixes #24356
2025-05-06 05:20:03 -07:00
db2b774a16 fix(runtime): 'includeexpr' with non-Nvim-style Lua modules #33867
Closes #33862
2025-05-06 05:15:31 -07:00
8d75910ef9 fix(treesitter): eliminate flicker for single windows #33842
This commit will eliminate flicker while editing one open window. It
works by querying previously calculated trees for highlight marks, in
the case that we are still asynchronously parsing in `on_win`.

It will not fully solve the case of flicker when there are multiple open
windows, since the parser will drop previously parsed injection trees
whenever it receives a call to parse a different region of the buffer.
This will require a refactor of `languagetree.lua`.
2025-05-05 19:05:16 -07:00
9efdd4fe98 fix(extui): drop "more" window that is no longer floating #33861
Problem:  Moving the "more" (or any extui)-window to a split with
          `wincmd L` does not invalidate it as a tracked window.

Solution: Drop an extui window that is no longer floating.
2025-05-05 11:28:02 -07:00
1e7406fa38 feat(api): nvim_cmd supports plus ("+cmd", "++opt") flags #30103
Problem:
nvim_cmd does not handle plus flags.

Solution:
In nvim_cmd, parse the flags and set the relevant `ea` fields.
2025-05-05 05:58:36 -07:00
912388f517 fix(messages): list_cmd kind for buffer line messages (#33855)
Problem:  Missing kind and separate event for each line for message
          containing buffer lines for e.g. `:print`.
Solution: Set the `list_cmd` kind and only `msg_start()` for the first
          message, print a newline instead.
2025-05-05 12:04:09 +00:00
2d75ea6afe Merge pull request #33753 from bfredl/hotgrid
fix(grid): don't scroll on an invalid grid
2025-05-05 11:20:13 +02:00
1ad9cdd403 fix(grid): check allocated grid size when suspicious scrolling
fixes #33749
2025-05-05 10:50:18 +02:00
40351bbbbe fix(lua): vim.validate message param #33675
Problem:
vim.validate does not handle `message` param.

Solution:
Add the missing logic.
2025-05-04 16:36:32 -07:00
0862c1036a fix(lsp): check if client is stopping before reuse #33796
Problem:
Stopping a language server and then calling vim.lsp.start() with the same name/root will return the old language server that's in the middle of shutting down. vim.lsp.start() won't return a new server until the old process has terminated.

Solution:
Introducing a client._is_stopping field that tracks the shutdown phase, preventing the client from being reused.
2025-05-04 14:38:01 -07:00
df345503eb refactor(lua): swap value params in tbl_extend behavior callback #33847 2025-05-04 14:28:03 -07:00
0402f5a76b Merge pull request #33848 from psnszsn/master
fix(build): musl libc build.zig
2025-05-04 23:21:37 +02:00
3268f51d20 fix(build): musl libc build.zig 2025-05-04 22:55:19 +02:00
d4ecfc4234 fix(extui): message may overwrite active cmdline #33846
Problem:  Active cmdline may be overwritten by a message.

Solution: Check if cmdline is active before writing message.
2025-05-04 20:02:02 +00:00
ba2a5a7787 Merge pull request #33837 from bfredl/cmakeversion
fix(build): use correct cmake expression for $<CONFIG>

fixes #33835
2025-05-04 19:35:07 +02:00
72ec410134 Merge #33789 cleanup error messages 2025-05-04 08:53:29 -07:00
fc2dee1736 feat(messages): cleanup Lua error messages
"Error" in error messages is redundant. Just provide the context, don't
say "Error ...".
2025-05-04 11:22:57 -04:00
af4f7f1618 test: multiline assert_log()
Problem:
assert_log() only matches single lines. This was never an intentional
decision, it was merely a result of using read_file_list().

Note: any tests that indiscriminately match `.*` should be rewritten to
avoid (unlikely) "false positives". I checked all existing tests.

Solution:
Change assert_log() to match the concatenated lines instead of matching
per-line.
2025-05-04 10:35:07 -04:00
8f5bd569c5 feat(lsp): support documentColor dynamic registration #33800 2025-05-04 07:00:21 -07:00
5c15df449a fix(lsp): improve error completion message #33812
problem: Error notifications from LSP responses were difficult to read due to
inconsistent formatting and missing critical information like client name and error codes.

solution: Implemented a more structured error notification format using pipe separators to
clearly display client name, error code (when available), and error message.
2025-05-04 06:40:35 -07:00
91e116f3a6 fix(lsp): only auto-detach lsp.config clients #33834
Problem:
enable() routine detaches clients even if they were manually started
and not managed by vim.lsp.config.

Solution:
Skip clients that aren't managed by vim.lsp.config.
2025-05-04 06:07:11 -07:00
cb2ca54331 fix(display): cursor moves when searching with "n", "*" #29446
Problem:
When searching for the next pattern via n/N/*/#, cursor
moves to cmdline, perceived as "flicker".

Solution:
Can ui_busy_start() and ui_busy_stop().
2025-05-04 05:53:25 -07:00
f1295fe76f fix(extui): hide inactive "more" window (#33831)
Problem:  More-window is left visible after leaving it. Cursor may be
          hidden behind it and it is hard to re-enter afterwards.
Solution: Close the more-window when another window is entered.
2025-05-04 13:39:07 +02:00
921f8b0df7 fix(build): use correct cmake expression for $<CONFIG>
${CONFIG} is an empty string even when configuration is known at
configuration time. $<CONFIG> has to be used at "generation time"

Currently zig's reimplementation of cmake config headers does not
support $<CONFIG> so use a branch to pick the one which works.
2025-05-04 09:49:10 +02:00
627c648252 vim-patch:9.1.1361: [security]: possible use-after-free when closing a buffer (#33820)
Problem:  [security]: Possible to open more windows into a closing
          buffer without splitting, bypassing existing "b_locked_split"
          checks and triggering use-after-free
Solution: Disallow switching to a closing buffer. Editing a closing
          buffer (via ":edit", etc.) was fixed in v9.1.0764, but add an
          error message and check just "b_locked_split", as "b_locked"
          is necessary only when the buffer shouldn't be wiped, and may
          be set for buffers that are in-use but not actually closing.
          (Sean Dewar)

closes: vim/vim#17246

6cb1c82840
2025-05-04 03:15:51 +01:00
2c1f5a6aa5 docs: default mappings #33706
Problem:
Docs don't mention that `gc` is just a mapping, not
a builtin normal-mode command.

Solution:
Update docs for all "default mappings".
2025-05-03 15:47:59 -07:00
9274532615 fix(treesitter): invalidate conceal_lines marks #33828
Problem:  Spliced conceal_lines marks after changing the buffer text are
          left valid, concealing lines that shouldn't be.

Solution: Set the `invalidate` extmark property.
2025-05-03 22:37:02 +00:00
b877aa34cf feat(lsp): detach LSP clients when 'filetype' changes #33707
Problem:
When the buffer 'filetype' changes, invalid or non-applicable LSP
clients are not detached.

https://github.com/neovim/neovim/issues/33443
https://github.com/neovim/nvim-lspconfig/issues/3326

Solution:
In the enable() routine, check can_start() on _existing_ clients.
2025-05-03 14:57:59 -07:00
047a10bfde feat(lua): function behavior for tbl_extend, tbl_deep_extend #33819 2025-05-03 14:53:44 -07:00
8305af9bd2 fix(statusline): clear ruler when it is no longer drawn #33765
Problem:  Ruler is not cleared from the screen/ext_messages state when
          it is no longer drawn after e.g. `set noruler` or when moving
          from a floating to a regular window.
Solution: Remember if ruler was drawn and clear it.
2025-05-03 14:24:11 -07:00
6256adde2f fix(quickfix): always split from current window #33807
Problem:  `:copen` opens at the bottom by switching to `lastwin`,
           needlessly changing the window it inherits context from.

Solution:  Use the `WSP_BOT` flag to `win_split()` to open at the bottom.
2025-05-03 13:38:20 -07:00
b2a5105c66 fix(extui): search highlighting in extui "more" pager #33792
Problem:  No search highlighting in extui "more" pager window.
Solution: Only use custom highlight namespace in cmdline window.
2025-05-03 12:30:08 -07:00
joe
d0867574bd refactor(tui): redundant input->in_fd assignment #33756
Problem:
`input->in_fd = STDIN_FILENO;` was set twice during TUI initialization.

Solution:
Remove the duplicate assignment for clarity and better performance
2025-05-03 11:37:14 -07:00
902b689c4d docs(lua): typing for vim.fn.winlayout #33817
Problem:
`any[]` means nothing, and the return value is not the same as what's
documented in the comment (eg, Lua returns `{ "row", { { "leaf", 1000 },
{ "leaf", 1001 } } }`, not `{ "row", { "leaf", 1000, "leaf", 1001 } }`)

Solution:
Create two classes (vim.fn.winlayout.leaf and vim.fn.winlayout.branch)
and one alias that links the two together.

Also: Due to LuaLS limitations, there is an empty class,
vim.fn.winlayout.empty

Signed-Off-By: VoxelPrismatic <voxelprismatic@pm.me>
2025-05-03 11:34:25 -07:00
403fcacfc1 fix(window): skip unfocusable and hidden floats with "{count}<C-W>w" #33810
Problem: Using `<C-W>w`, `<C-W>W` or the ":wincmd" variants with a count can
enter unfocusable or hidden floating windows. This is especially problematic
when using the new in-development extui, which creates many unfocusable floats
for various UI elements.

Solution: Skip unfocusable and hidden floating windows. Instead, skip to the
next focusable, non-hidden window in the current tabpage's window list. Reword
the documentation a bit (hopefully an improvement?)
2025-05-03 11:30:24 -07:00
03d378fda6 feat(lsp): vim.lsp.is_enabled() #33703
Problem:
No way to check if a LSP config is enabled without causing it to
resolve. E.g. `vim.lsp.config['…'] ~= nil` will resolve the config,
which could be an unwanted and somewhat expensive side-effect.

Solution:
Introduce `vim.lsp.is_enabled()`.
2025-05-03 10:25:58 -07:00
2e35161fa1 docs: treesitter parse errors #33811 2025-05-03 10:08:53 -07:00
94bc7f47bf docs: fixups (#33815)
- Add missing diagnostics virtual lines hl groups.
- Fix LSP dynamic registration example; curbuf may not actually be attached to
  the client, and it may be attached to many such buffers.
2025-05-03 16:45:32 +01:00
f048298e9a fix(runtime): conceal paths in help, man ToC loclist #33764
Problem:
The check for concealing paths in TOCs in the qf syntax file fails
because the TOC tile has changed.

Solution:
Force the qf syntax file to be reloaded after the qf_toc variable
has been set, so that the it can apply the correct settings.

Using the explicit qf_toc key, already used in the syntax file, instead
of the title is less prone to breaking.

It was also already being set for man pages but it had no effect because
the syntax file had already been loaded when the variable was set.

Fixes #33733
2025-05-03 07:06:22 -07:00
6b233cd1a1 build(deps): bump tree-sitter-vim to v0.6.0 2025-05-03 11:29:34 +02:00
5d1fd4aca5 fix(lsp): improper diagnostic end_col computation
**Problem:** For multiline diagnostics, the end column was improperly
calculated by checking the byte index of the character position on the
*start* line.

**Solution:** Calculate the byte index for end_col using the *end* line.
2025-05-03 10:01:20 +02:00
adbd33027f fix(tui): don't try to add unsupported modifiers (#33799)
Problem:  The TUI doesn't forward a key properly when it has unsupported
          modifiers like NumLock.
Solution: Don't try to add modifiers when only unsupported modifiers are
          present.

Related #33791
2025-05-03 12:09:28 +08:00
862e676efc docs: add missing change to getcharstr() signature (#33797) 2025-05-03 08:10:13 +08:00
5a2edc483d fix(treesitter): close :InspectTree with q
Problem: `:InspectTree` window does not follow precedent for focused
"info windows" (like `checkhealth`, `Man`, etc.).

Solution: Map `q` to `<C-w>c`.
2025-05-02 21:39:11 +02:00
34c769dd89 fix(lsp): use bufnr when getting clients in symbols_to_items (#33760) 2025-05-02 14:30:02 -05:00
39a5b7f239 fix(extui): cmdline visibility, cmdheight cursor position (#33774)
Problem:  The cmdline popupmenu is hidden behind extui windows.
          'showmode' message is drawn over the cmdline.
          Changing the 'cmdheight' to accommodate space for the text in
          the cmdline may change the current cursor position.
Solution: Ensure kZIndexMessages < zindex < kZIndexCmdlinePopupMenu.
          Clear the 'showmode' message when the cmdline level is negative.
          Temporarily set 'splitkeep' = "screen" when changing the 'cmdheight'.
2025-05-02 19:46:30 +02:00
c916bdf329 fix(extui): close message window with q
Problem: Using `<c-c>` does not follow precedent (from `checkhealth`
etc.) for closing "information windows".

Solution: Use `q` for close mapping.
2025-05-02 19:09:56 +02:00
8d6f016345 vim-patch:c3f48e3: runtime(abnf): include ABNF filetype plugin
closes: vim/vim#17239

c3f48e3a76

Co-authored-by: A4-Tacks <wdsjxhno1001@163.com>
2025-05-02 17:12:18 +02:00