Problem: Closing a floating window from a non-current tab frees its grid
without removing it from the compositor's `layers` table, so the next
`ui_comp_put_grid()` walks a dangling pointer (UAF).
Solution: Call `ui_comp_remove_grid()` (and `ui_call_win_close()` for
multigrid UIs) before `win_free_mem()`, matching `win_close()` since
PR #21551.
Problem: Every LSP capability that sends a request on a document change
to update its state was using its own buffer-local autocmd to do so.
That means there is a separate autocmd per buffer per active
capability/feature, and the actual code inside the autocmd callback was
virtually identical. The same problem occurred for capabilities that had
components to draw on the screen that had their own decoration providers.
Solution: Introduce a central `LspNotify` autocmd and decoration
provider in the capability module itself. New base class methods
`on_close` and `on_change` that take a client_id have been provided, for
`didClose` and `didOpen`/`didChange` notifications respectively. New
base class method `on_win` that takes topline and botline has been
provided to add extmarks or perform other work when lines of a buffer
are being drawn.
The autocmd callback loops through each active capability instance for
the buffer and calls a corresponding method with the triggering
client_id if it is currently attached to the buffer that triggered the
autocmd. The decoration provider just calls on_win for all active
capabilities on the buffer.
This slightly tweaks folding range to make use of these new client-id
specific callbacks.
Problem
The current list of properties for inlay hint resolve support includes a
non-existent "location". This field should be "label.location" according
to the specification. Tooltips and commands for inlay hint "parts"
aren't advertised as being resolvable.
Solution
Remove "location" and add "label.location", "label.tooltip", and
"label.command".
Closes#40740
Problem:
- No UI for listing extmarks.
- `:marks` doesn't support cmdline-completion.
Solution:
- Add completion and extmarks support to `:marks`.
- Update `get_buf_local_marks` to include the ":" (prompt-buffer) mark.
Following features must be N/A to detect v8.Y.0000 as N/A
- VisVim
- Windows *.def files
- Gvim
- runtime/doc/version8.txt ("too old")
(https://github.com/neovim/neovim/pull/1116 deletes version7.txt)
PR https://github.com/neovim/neovim/pull/36585 enabled
"scripts/vim-patch.sh", "scripts/vimpatch.lua" to optimize out
(all?) macros from Vim's "src/version.h".
If it does have relevant updates, then the applicable files
(ie. src/version.c) will use them to make the patch applicable.
Goal - Detect N/A patches for Vim release vX.Y.0000.
Problem:
Vimscript ftplugins that inherit a base ftplugin often use explicit
`runtime! ftplugin/foo.vim` patterns. This skips corresponding Lua
ftplugins, unlike top-level ftplugin loading.
Solution:
Use the existing `{vim,lua}` patterns for bang runtime imports while
preserving each call's current lookup breadth.
Problem:
This functions are most likely never used in the wild.
- They are redundant with `nvim_get_context` + `nvim_load_context`.
- The "context" concept was never fully developed and hasn't gained
traction.
Solution:
Drop these vimscript aliases, they are just extra cruft.
Problem:
`FileType directory` fires *before* the `BufEnter` path where `dir.lua`
populates the buffer, in order to allow a 3P dir-browser plugin to handle the
event and (optionally) rename the buffer to e.g. `example:///tmp/foo/`.
But currently, `open_buffer()` continues after `filetypedetect BufRead` as if
the original directory buffer is *still* current and valid, which may fall
through to the built-in `nvim.dir` path after a 3P plugin ALREADY handled the
directory.
Solution:
Keep a buf ref around the early `filetypedetect BufRead` call for directory
buffers.
If the `FileType directory` handler switches away from/deletes the original
directory buffer, stop the open path instead of continuing into the built-in
`nvim.dir` flow.
Problem:
After 25439dad7e, `opts` is optional, but not params that follow it.
Solution:
- Update `gen_api_dispatch.lua`, docs, tests.
- Enhance the `nvim_get_api_info()` api-metadata to include a boolean
flag indicating whether a parameter is optional:
```
[type, name, optional]
```
Note: Currently, optional params are assumed to be Dict/Array. Since we
don't yet have any use-cases of optional params following `opts`, the
build just checks this assumption and we can deal with it later if we
ever care to:
nvim_get_hl: optional param "foo" has type "Integer" but (currently)
we assume Dict/Array
FAILED …/plugin/pack_spec.lua:92: …/plugin/pack_spec.lua @ 70: vim.pack update() can use lockfile revision as a target
…/plugin/pack_spec.lua:92: …/plugin/pack_spec.lua:70: process still exists
stack traceback:
D:/a/neovim/neovim/test/functional/testnvim/exec_lua.lua:124: in function 'system_sync'
…/plugin/pack_spec.lua:92: in function 'git_cmd'
…/plugin/pack_spec.lua:113: in function 'git_add_commit'
…/plugin/pack_spec.lua:1209: in function <…/plugin/pack_spec.lua:1173>
fix#40167
Problem:
|api-contract| allows adding an optional trailing `opts` parameter, but
the dispatch generator still requires every parameter, so `opts` cannot
be omitted.
Solution:
Treat a trailing `Dict(...) *opts` parameter as optional in the generated
RPC and Lua dispatch wrappers.
Co-authored-by: Judit Novak <judit.novak@gmail.com>
Problem:
If you have this repo forked, the workflow for Coverity Scan creates a lot of
spammy emails about that workflow failing.
Solution:
Check for the presence of `COVERITY_SCAN_TOKEN` and `COVERITY_SCAN_EMAIL` at the
very start of `.github/workflows/coverity.yml`, skip the rest of the workflow if
they are absent. Unfortunately, Github Actions don't offer a straightforward way
of doing that, so using [this workaround](https://github.com/orgs/community/discussions/25280)).
Problem:
A successful `BufReadCmd` can leave an existing `filetype` without
rerunning its `FileType` setup, so state cleared during reload may not
be restored.
This also causes `:edit`/reload syntax `directoryDirectory` groups to
not be reapplied.
Solution:
After `BufReadCmd` handles a read, trigger `FileType` for the existing
`filetype` if no `FileType` event fired during the read.
Problem:
Insert-mode globals are scattered.
Solution:
Group them into one struct. Besides improving readability and
discoverability, this greatly helps with save/restore of an insert-mode
session.
Problem:
Continue separators normalization, and try to keep it at the
nvim <-> external boundary, e.g., `fn.xxx`, `api.xxx`, `:xxx`
Solution:
some key changes
- normalize `$HOME-windows`
- normalize entry points of changing directory
- `nvim_set_current_dir()`, `chdir()`
- normalize the named pipe
- `--listen` arg, `--server` arg, `:restart`
- `serverstart()`, `sockconnect()`, `serverstop()`
- make `expand()` respect 'shellslash' again
- clean up `did_set_shellslash`
- replace `forward_slash` with `TO_SLASH`
- remove obsolete `TMP_PATHSEPSTR`
- remove `slash_adjust` in `do_autocmd_dirchanged`?
- make `fnamemodify()` always return `/` (except when substituting
separators via `:s`, `:gs` ?)
Note:
- these funcs still apply `slash_adjust` on return, as before:
`:pwd`, `chdir()`, `exepath()`, `getcwd()`
- these funcs alwarys return `/`, unlike before the normalization PRs
- `getcompletion()`, `finddir()`, `findfile()`
Also
- clean up code, comments, formatting and tests
- move `TO_SLASH` from `f_chdir` to `changedir_func`
- move `TO_SLASH` from `f_bufadd` to `buflist_new`
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Problem:
Malformed server responses with `null` (vim.NIL) values, do not show
clear error messages.
Solution:
Assert two known, specific cases, to avoid user confusion.
Problem: When a split window is created from the init script using nvim_open_win()
with enter=false, the current window focus is not preserved. The cursor
incorrectly moves into the newly created split during startup.
Solution: Save curwin before the iteration loop in create_windows(), and
restore it after the loop. also update edit_buffers() to use curwin instead
of firstwin.
Problem:
- `edit.c` is an unnecessarily misleading and less-discoverable name
than `insert.c`.
- Numerous insert-mode related things are named with a `ins_` prefix.
- There is already a `insexpand.c` module...
Solution:
Rename `edit.c` => `insert.c`.
CID 649145: Error handling issues CHECKED_RETURN
/src/nvim/api/window.c: 138 in nvim_win_set_cursor()
132 // Make sure we stick in this column.
133 w->w_set_curswant = true;
134
135 // make sure cursor is in visible range and
136 // cursorcolumn and cursorline are updated even if w != curwin
137 CtxSwitch switchwin;
>>> CID 649145: Error handling issues (CHECKED_RETURN)
>>> Calling "ctx_switch" without checking return value (as is done elsewhere 5 out of 6 times).
138 ctx_switch(&switchwin, w, NULL, NULL, kCtxNoEvents | kCtxNoDisplay);
139 update_topline(curwin);
140 validate_cursor(curwin);
141 ctx_restore(&switchwin);
142
143 redraw_later(w, UPD_VALID);
Problem:
`getchar.c` is a quirky name and doesn't align with our existing
`os/input.c` and `tui/input.c` modules, which encompass the same topic
at different layers.
Solution:
Rename `getchar.c` => `input.c` for discoverability.
Introduce `dialog.c` for functionality related to showing confirm
prompts, dialogs, etc.
Problem:
URI buffer names can end with a slash, but slash-ended directory
matching should not preempt URI filetype patterns.
Solution:
Do not use the slash shortcut for names with URI schemes, so those
continue through normal filetype matching.
Co-authored-by: Adam Karafyllidis <akisarou90@gmail.com>
Like `v:echospace`, `sc_col` was used in many places to avoid disruptive
"Press ENTER" prompts. Since those are no longer a problem with ui2, the
complexity of keeping these variables up-to-date and maintaining bespoke
truncation code at the message producers is no longer justified.
Unfortunately, some messages still need to be kept under 1 line to avoid
glitches.
`ru_wid`, `ru_col`, and `sc_col` are now no longer used when ui2 is
enabled, except `ru_col` in the C implementation of the default ruler,
which will be replaced by a default expression.
The purpose of `v:echospace` was to avoid disruptive "Press ENTER"
prompts. Since those are no longer a problem with ui2, the complexity
of maintaining it up-to-date is no longer justified.