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/RLoginFixes#24356
(cherry picked from commit 8707ec2644)
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.
(cherry picked from commit 0862c1036a)
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.
(cherry picked from commit 5c15df449a)
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.
(cherry picked from commit 91e116f3a6)
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.
(cherry picked from commit 9274532615)
Problem:
Docs don't mention that `gc` is just a mapping, not
a builtin normal-mode command.
Solution:
Update docs for all "default mappings".
(cherry picked from commit 2c1f5a6aa5)
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>
(cherry picked from commit 902b689c4d)
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?)
(cherry picked from commit 403fcacfc1)
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()`.
(cherry picked from commit 03d378fda6)
- 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.
(cherry picked from commit 94bc7f47bf)
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
(cherry picked from commit f048298e9a)
**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.
(cherry picked from commit 5d1fd4aca5)
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
(cherry picked from commit adbd33027f)
Problem: `:InspectTree` window does not follow precedent for focused
"info windows" (like `checkhealth`, `Man`, etc.).
Solution: Map `q` to `<C-w>c`.
(cherry picked from commit 5a2edc483d)
This fixes the problem that sending a raw C0 control code to trigger a
mapping for it does not work in Terminal mode.
Note: this isn't done for 00 or 7F, as that'll be backward-incompatible.
(cherry picked from commit 4b5364b423)
Problem: Wrong winline info after partial redraw. Setting
`conceal_cursor_used` is unnecessarily spread out.
Solution: Rather than adjusting `wl_lastlnum` for the previous
winline, adjust it when setting the current winline.
Set `conceal_cursor_used` when the current window is redrawn.
(cherry picked from commit 97a6259442)
Problem:
enable() could be more flexible, so that it works even if called "late".
Solution:
- enable(true) calls `doautoall nvim.lsp.enable FileType`.
- enable(false) calls `client:stop()` on matching clients.
This will be useful for e.g. :LspStop/:LspStart also.
(cherry picked from commit 4bc7bac884)
Problem:
Directories that are "trusted" by `vim.secure.read()`, are not detectable later
(they will prompt again). https://github.com/neovim/neovim/discussions/33587#discussioncomment-12925887
Solution:
`vim.secure.read()` returns `true` if the user trusts a directory.
Also fix other bugs:
- If `f:read('*a')` returns `nil`, we treat that as a successful read of
the file, and hash it. `f:read` returns `nil` for directories, but
it's also documented as returning `nil` "if it cannot read data with the
specified format". I reworked the implementation so we explicitly
treat directories differently. Rather than hashing `nil` to put in the
trust database, we now put "directory" in there explicitly*.
- `vim.secure.trust` (used by `:trust`) didn't actually work for
directories, as it would blindly read the contents of a netrw buffer
and hash it. Now it uses the same codepath as `vim.secure.read`, and
as a result, works correctly for directories.
(cherry picked from commit 272dba7f07)
Problem: Cursor is still moved to curwin when entering cmdline (after d41b8d47).
Solution: Remove call to `setcursor()`.
(cherry picked from commit 0015a105ca)
Problem:
Tests call `clear()` even though `clear_notrace()` is already called in
a `before_each()` handler, wasting precious milliseconds!
Solution:
Remove redundant `clear()` calls.
- sort fields alphabetically.
- in the `vim.lsp.Client` docs, reference `vim.lsp.ClientConfig` instead
of duplicating its docs.
- cleanup lots of redundant-yet-drifted field docs.
When the TUI is suspending or stopping, redraw events should not be
processed, as when it next processes redraw events it's already waiting
for a DA1 response after having disabled some terminal modes.
Fix#33708
(cherry picked from commit c35dde03c8)
This reverts commit 6e12ef4a7b
> Paths with spaces were already working. The original bug is most
> likely with user's terminal desktop entry, file manager or DE, and has
> nothing to do with nvim.desktop.
These are 3 different implementations that work correctly with unquoted %F and spaces:
```
$ DE=generic xdg-open "D I R/F I L E.txt" # pure bash
$ gio open "D I R/F I L E.txt" # glib2
$ handlr open "D I R/F I L E.txt" # rust
```
(cherry picked from commit 07a207a5f1)
Problem:
As checkhealth grows, it is increasingly hard to quickly glance through
the information.
Solution:
Show a summary of ok, warn, and error outputs per section.
Problem:
`FileType` event is fired before checkhealth report is finished, so
user can't override report settings or contents.
https://github.com/neovim/neovim/pull/33172#issuecomment-2833513916
Solution:
- Trigger FileType event later.
- Document how to remove emojis.
* vim-patch:829eda7: runtime(new-tutor): update tutor and correct comandline completion
Problem: Some parts of the tutor are outdated.
- For example, pressing `<Tab>` after typing `:e` does not complete the
command `:edit`, but shows a completion menu with the first entry being
`:earlier`.
closes: vim/vim#17107829eda7d38
Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
(cherry picked from commit 374e52a7ee)
* docs: provide example_init.lua #33524
Problem:
There are some "boilerplate" steps for new users. Although we are
constantly improving defaults and lifting patterns into core, users
eventually want to know how to start their own config, add plugins, etc.
Solution:
Add `runtime/example_init.lua` and refer to it from docs.
(cherry picked from commit 86b34ad073)
---------
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Problem:
There are some "boilerplate" steps for new users. Although we are
constantly improving defaults and lifting patterns into core, users
eventually want to know how to start their own config, add plugins, etc.
Solution:
Add `runtime/example_init.lua` and refer to it from docs.
(cherry picked from commit 86b34ad073)
Problem: Some parts of the tutor are outdated.
- For example, pressing `<Tab>` after typing `:e` does not complete the
command `:edit`, but shows a completion menu with the first entry being
`:earlier`.
closes: vim/vim#17107829eda7d38
Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
(cherry picked from commit 374e52a7ee)
Problem:
In cases when the (in-process) LSP server responds to the request
immediately and calls `notify_reply_callback` the request will still be
marked as pending, because the code assumes that the response will occur
asynchronously. Then the request will be pending forever, because it was
already set as "completed" before we even set it as "pending".
A workaround is to wrap `notify_replay_callback` in `vim.shedule` ([like
so](https://github.com/neovim/neovim/pull/24338#issuecomment-2809568617)]
but that seems counterintuitive.
Solution:
Handle this case in Client:request().
(cherry picked from commit 8315697449)
Problem: As in f85bc41, assume unfocusable windows to be UI windows
whose buffer content is unexpectedly included in 'complete'
"w" completion.
Solution: Exclude unfocusable windows when looping over windows.
(cherry picked from commit d01b2611a6)
Problem:
Some language servers do not work properly without a workspace folder.
Solution:
Add `workspace_required`, which skips starting the lsp client if no
workspace folder is found.
Co-authored-by: Michael Strobel <71396679+Kibadda@users.noreply.github.com>
Problem: Undo corrupted with 'completeopt' "preinsert" when switching
buffer or window.
Solution: Do not delete preinsert text when switching buffer or window.
(zeertzjq)
related: neovim/neovim#33581closes: vim/vim#171931343681aba
(cherry picked from commit 63689deb45)
Problem: Change applied in d3e495ce uses a byte-offset where a virtual
column is expected.
Solution: Set the cursor directly through a <Cmd> mapping, while making
sure the commands are ordered correctly by adding them to the
type-ahead buffer.
(cherry picked from commit 019b2050e1)