Problem:
The cmdpreview saved undo nodes on cmdpreview_prepare() from ex_getln.c may
become invalid (free) if the preview function makes undo operations, causing
heap-use-after-free errors.
Solution:
Save the buffer undo list on cmdpreview_prepare)_ and start a new empty one. On
cmdpreview_restore_state(), undo all the entries in the new undo list and
restore the original one. With this approach, the preview function will be
allowed to undo only its own changes.
Fix#20036Fix#20248
Problem: No test for bad use of spaces in help files.
Solution: Add checks for use of spaces in help files. Ignore intentional
spaces. (Hirohito Higashi, closesvim/vim#11952)
d950984489
Cherry-pick changes from patch 9.0.1604.
Co-authored-by: h-east <h.east.727@gmail.com>
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem:
Content that has codeblocks with different languages, results in
multiple calls to:
syntax include vim syntax/vim.vim
which raises error:
E403: syntax sync: line continuations pattern specified twice
Before ba8f19ebb6, this was avoided by
using pcall() to ignore the error.
Solution:
Restore the use of pcall() to ignore the error.
We plan to replace this logic with a treesitter approach, so this is
good enough for now.
Fix#24431
* fix(lsp): replace @private with @nodoc for public client functions
To prevent lua-ls warnings in plugins which use the functions.
* fix(lsp): remove duplicate type annotations/class definitions
These annotations became duplicate with https://github.com/neovim/neovim/pull/23750
When adding `workspace/didChangeWorkspaceFolders` support to my [language server](https://github.com/elixir-tools/next-ls), I noticed that when neovim removes a workspace, it sends an empty table (which is serialized to an empty JSON array) for the value in the `added` field.
This does not follow the spec; the `added` table should just be empty.
The following error led me to this discovery. Note the payload includes `"added" => [[]]`:
```
22:46:48.476 [error] LSP Exited.
Last message received: handle_notification %{"jsonrpc" => "2.0", "method" => "workspace/didChangeWorkspaceFolders", "params" => %{"event" => %{"added" => [[]], "removed" => [%{"name" => "/Users/mitchell/src/gen_lsp", "uri" => "file:///Users/mitchell/src/gen_lsp"}]}}}
** (MatchError) no match of right hand side value: {:error, %{"params" => %{"event" => %{"added" => [error: "expected a map"]}}}}
(gen_lsp 0.4.0) lib/gen_lsp.ex:265: anonymous fn/4 in GenLSP.loop/3
(gen_lsp 0.4.0) lib/gen_lsp.ex:292: GenLSP.attempt/3
(stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
```
In the case you hit this warning in a buffer (like with C++ and clangd),
this message potentially fires over and over again making it difficult
to use the editor at all.
Problem:
netrw may conflict with the Nvim default "gx" mapping.
Solution:
Initialize keymapping earlier by moving it to vim._init_default_mappings().
That also avoids needing to check maparg().
Problem: Cannot drag a vertical separator to the right of a window
whose 'statuscolumn' is wider than itself.
Solution: Never treat a click on a vertical separator as a click on
'statuscolumn'.
Problem:
When the CurSearch highlight group is set, and a search is active and
you are listening to the remote UI "win_viewport" events, then typing is
very unresponsive, because "win_viewport" is not sent as soon as the
character is typed. On the other hand if you refresh the screen on
"flush", the screen will scroll with a delay since "win_viewport" comes
too late. I estimate this delay be up to one second, but it varies.
Solution:
Call validate_cursor() before drawing the screen, just like other modes.
No tests have been added because only the intermediate state is wrong.
Avoid consecutive RPC requests involving :startinsert or :stopinsert,
because consecutive RPC requests may be processed together, before the
:startinsert or :stopinsert takes effect.
Also change some feed_command() to command() to make tests faster.
Problem:
On Windows, `rundll32` exits zero (success) even when given
a non-existent file.
Solution:
Mock vim.system() on Windows to force a "failure" case.
Previously, when using foldmethod=indent, inserting an unindented line
would inadvertently open closed folds below it.
As a performance improvement, folds were only updated once, across all
lines, after Insert mode was exited.
Now, the performance improvement is no longer being used when
foldmethod=indent, so folds are updated multiple times during Insert
mode, but only across the lines that are changing, which preserves the
folds (and their open/close states) instead of recreating them.
* docs(lua): teach lua2dox how to table
* docs(lua): teach gen_vimdoc.py about local functions
No more need to mark local functions with @private
* docs(lua): mention @nodoc and @meta in dev-lua-doc
* fixup!
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
---------
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>