Problem: The matchparen plugin is slow on a long line.
Solution: Don't use a regexp to get char at and before cursor.
(zeertzjq)
Example:
```vim
call setline(1, repeat(' foobar', 100000))
runtime plugin/matchparen.vim
normal! $hhhhhhhh
```
closes: vim/vim#1556881e7513c86
(cherry picked from commit cf44121f7f)
fix(terminal): interrupt/got_int hangs terminal (#30056)
Upon `terminal_enter`, `mapped_ctrl_c` is set in order to avoid `CTRL-C`
interrupts (which is proxied to the terminal process instead), `os_inchar`
will then test `mapped_ctrl_c` against `State` and set `ctrl_c_interrupts=false`
which prevents `process_ctrl_c` from setting `got_int=true` in a terminal
state.
However, if `got_int` is set outside of `process_ctrl_c`, e.g. via
`interrupt()`, this will hang the neovim process as `terminal_execute` will
enter an endless loop as `got_int` will never be cleared causing `safe_vgetc`
to always return `Ctrl_C`.
A minimal example reproducing this bug:
```vim
:autocmd TermEnter * call timer_start(500, {-> interrupt()})
:terminal
:startinsert
```
To fix, we make sure `got_int` is cleared inside `terminal_execute` when
it detects `Ctrl_C`.
Closes#20726
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: ibhagwan <59988195+ibhagwan@users.noreply.github.com>
Problem:
The windows installer did not have the AllUsers property which leads to
the installer being misidentified as per user installer.
Currently the installer already requires administrative privileges and
installs into the system-wide ProgramFiles directory, but the start menu
entry and uninstaller registration are created only for the current user.
Issue: #29885https://cmake.org/cmake/help/latest/cpack_gen/wix.html#variable:CPACK_WIX_INSTALL_SCOPE
Solution:
With setting CPACK_WIX_INSTALL_SCOPE to "perMachine" the generated msi
installer includes the Property ALLUSERS=1.
Additionally the start menu entries and uninstaller registration will be
created for all users.
(cherry picked from commit 88f07d6ca4)
Problem: Some other options reset curswant unnecessarily when set.
(Andrew Haust)
Solution: Don't reset curswant when setting 'comments', 'commentstring'
or 'define' (zeertzjq)
fixes: vim/vim#15462closes: vim/vim#15467b026a293b1
(cherry picked from commit 0ec43cb4b5)
Problem: When preparing the parameters for a code actions LSP request,
the code set `context.diagnostics` when processing the first LSP client,
and then reused those `context.diagnostics` for subsequent LSP clients.
This meant that the second and next LSP clients got diagnostics that
did not originate from them, and they did not get the diagnostics that
they sent.
Solution: Avoid setting `context.diagnostics` (which is referenced by
all clients). Instead, set `params.context.diagnostics` directly, which
is specific to a single client.
Fixes#30001
Caused by #29501
(cherry picked from commit 7031949be0)
When the cursor is moved we terminate any active OSC 8 sequences to
prevent the sequence from inadvertently spanning regions it is not meant
to span. However, if we do not also reset the TUI's active attr id
(print_attr_id) then the TUI does not "know" that it's current attribute
set has changed. When cursor_goto is called to wrap a line, the TUI does
not recompute the attributes so the OSC 8 sequence is not restarted
again.
When we terminate an OSC 8 sequence before moving the cursor, also reset
the active attr id so that the attributes are recomputed for URLs.
(cherry picked from commit f32557ca67)
Problem: [security] double-free in dialog_changed()
(SuyueGuo)
Solution: Only clear pointer b_sfname pointer, if it is different
than the b_ffname pointer. Don't try to free b_fname,
set it to NULL instead.
fixes: vim/vim#15403
Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-46pw-v7qw-xc2fb29f4abcd4
Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit 6967c08840)
- common_function() has always been in evalfunc.c in Vim
- return_register() has always been in evalfunc.c in Vim
- get_user_input() was moved to ex_getln.c in Vim 8.1.1957
- tv_get_lnum_buf() was moved to typval.c in Vim 8.2.0847
(cherry picked from commit 383f693472)
Problem:
If there are errors in the last line of a buffer, something like `Gdk` or
`G2k3J` will produce an error (at least with `lua_ls`):
Error executing vim.schedule lua callback:
.../neovim/share/nvim/runtime/lua/vim/diagnostic.lua:1446: Invalid 'line': out of range
Solution:
Only set extmarks if the target buffer line still exists
(cherry picked from commit e5e81262af)
`buf.code_action` always included diagnostics on a given line from all
clients. Servers should only receive diagnostics they published, and in
the exact same format they sent it.
Should fix https://github.com/neovim/neovim/issues/29500
(cherry picked from commit 720b309c78)
Problem: [security] use-after-free in tagstack_clear_entry
(Suyue Guo )
Solution: Instead of manually calling vim_free() on each of the tagstack
entries, let's use tagstack_clear_entry(), which will
also free the stack, but using the VIM_CLEAR macro,
which prevents a use-after-free by setting those pointers
to NULL
This addresses CVE-2024-41957
Github advisory:
https://github.com/vim/vim/security/advisories/GHSA-f9cr-gv85-hcr48a0bbe7b8a
Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit 6af359ef4c)
Problem: [security]: use-after-free in check_argument_type
Solution: Reset function type pointer when freeing the function type
list
function pointer fp->uf_func_type may point to the same memory, that was
allocated for fp->uf_type_list. However, when cleaning up a function
definition (e.g. because it was invalid), fp->uf_type_list will be
freed, but fp->uf_func_type may still point to the same (now) invalid
memory address.
So when freeing the fp->uf_type_list, check if fp->func_type points to
any of those types and if it does, reset the fp->uf_func_type pointer to
the t_func_any (default) type pointer
closes: vim/vim#136520f28791b21
Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit a4bec30b7b)
Problem: [security]: use-after-free in exec_instructions()
Solution: get tv pointer again
[security]: use-after-free in exec_instructions()
exec_instructions may access freed memory, if the GA_GROWS_FAILS()
re-allocates memory. When this happens, the typval tv may still point to
now already freed memory. So let's get that pointer again and compare it
with tv. If those two pointers differ, tv is now invalid and we have to
refresh the tv pointer.
closes: vim/vim#136215dd41d4b63
Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit 9f2d793068)
Problem: E1510 may happen when formatting a message
(after 9.1.0181).
Solution: Only give E1510 when using typval. (zeertzjq)
closes: vim/vim#153910dff31576a
(cherry picked from commit d131c48c82)
Fix the following two issues:
- pyenv root detection issue
When `PYENV_ROOT` environment variable is not set, neovim will detect
pyenv's root via `pyenv root` command, but which will be always fail
because `vim.fn.system()` returns result with additional `\n`. Using
`vim.system` instead prevents this problem. to trim it before check
whether it is exists
- python executable path detection issue
Filter unrelated `python-config` in cases where multiple python versions
are installed, e.g. `python-config`, `python3.10-config`,
`python3.11-config` etc.
(cherry picked from commit b4b4cf46a7)
This is a maintenance release.
FEATURES
--------------------------------------------------------------------------------
- ebc6c38cde lsp: update LSP healthcheck format (#28988)
BUILD
--------------------------------------------------------------------------------
- ba90b54301 deps: drop unused bundled bash, python parsers and queries
- 803cc08c17 deps: bump tree-sitter-c to v0.21.3
- 91e337a477 deps: bump tree-sitter-query to v0.4.0
- 978b63a9f1 deps: bump tree-sitter-vimdoc to v3.0.0
- b322c3560b "popcount" name conflict on NetBSD #28983
- b397b5672c remove -O2 from gen_cflags
- f77db12995 reuse code for deps.txt for both deps and main build
- 46d2906332 macos: disable deduplication in link step
FIXES
--------------------------------------------------------------------------------
- 70f7708cdf assert failure in VimL expression parser
- 28f03205be show swapfile warning as a warning (#28972)
- 0d293e4315 api: alloc and draw cursor window in nvim__redraw
- e1b6187801 colorscheme: underline StatusLineNC with 'notermguicolors' #28810
- aa1321801d column: clamp line number for legacy signs
- df6ce8377f column: crash with 'signcolumn' set to "number" (#29003)
- 97be9d8563 column: modifying a sign should update placed signs (#29750)
- 21b21b94e6 comment: fall back to using trimmed comment markers (#28950)
- 0827279ff5 defaults: default @/Q broken when 'ignorecase' is set (#29343)
- 5d9f2d7ecc drawline: don't draw beyond end of window (#29035)
- eadc4e03a2 drawline: don't draw beyond end of window with 'rnu' (#29406)
- bec397edda extmarks: issues with revalidating marks #28961
- 1fe1f8556e filetype: fix typos in filetype detection
- ad55ec350c float: handle error in win_float_create() (#29742)
- bf16fe3f01 fs: make vim.fs.root work for relative paths and unnamed buffers (#28973)
- 5eaae797af health: broken ruby detect #28804
- 24ee2e7c74 health: fix fetching url with python in provider health (#29594)
- 7582d4a7b5 input: handle vim.on_key() properly with ALT and K_SPECIAL (#29677)
- 4f0c4c3921 lsp: add textDocument/documentLink to capability map (#28838)
- 2d7aab623e lsp: avoid vim.keymap.del error when stopping a client (#29478)
- bdd5871dc5 lsp: check if buffer was detached in on_init callback (#28942)
- d8ff216040 lsp: clear lsp client diagnostics (#29091)
- 3a727beafd lsp: detach all clients on_reload to force buf_state reload (#28898)
- e98637e8c0 lsp: do not detach from buffer if there are uninitialized clients (#29043)
- 0ee3147bc7 lsp: do not reset buf version when detaching client (#29273)
- 24fa65a500 lsp: don't show codelens for buffers that don't support it (#29690)
- 4efca7cda5 lsp: handle nil root_dir in health check (#29010)
- efe8a0a520 lsp: hide layout in codelenses in virtual text (#28794) (#28895)
- 2fb69ccaf7 lsp: inlay hints are rendered in the correct order (#29707)
- dfff482efe lsp: remove superfluous on_detach callback from semantic tokens module (#29188)
- 10a16c1311 lsp: trigger LspDetach on buffer delete
- 33121f1eae lua: change some vim.fn.expand() to vim.fs.normalize() (#29583)
- ffc457a1dc marks: revalidate marks whose position did not change
- f82d7b8200 mouse: early return when clicking in padded 'statuscolumn' (#29394)
- d6756fc0a5 move: half-page scrolling with resized grid at eob (#28821)
- 0cf7e2570c path: avoid chdir() when resolving path (#28799)
- 63ff7338ea quickfix: make shortmess+=O work with cmdheight=0 (#29609)
- 46c2962b3a runtime: add commentstring for glsl ftplugin
- b98aa783f3 runtime: source c ftplugin properly for cpp on Windows (#29053)
- 039121f5a3 snippet: cancel snippet session when leaving the buffer (#29044)
- 84d7bfcf16 snippet: don't override unnamed register on tabstop select (#29008)
- e13f03af85 snippet: modify base indentation when there's actually whitespace (#29670)
- 9fd6664ba7 tohtml: extmark text may be out of bounds
- 8c88f402e1 tohtml: ignore lsp inlay hints
- 5cdf0c22bd tohtml: properly handle multiple hl groups #29012
- 3d319092d5 tohtml: replace ipairs with pairs
- 4150e5e6fd tohtml: show how many warnings are hidden
- 0389472961 tohtml: support ranges again
- ab2d243fd0 treesitter: display fields for anonymous nodes in :InspectTree
- 35f6425207 treesitter: do not modify highlight state for _on_spell_nav
- 356ddb1305 treesitter: ensure syntaxset augroup exists (#29542)
- eb53aba5af treesitter: recognize aliased parsers in omnifunc, query linter
- b6b2272573 tui: move $COLORTERM check to _defaults.lua (#29206)
- 89f29fcc92 tui: remove duplicate disabling of synchronized output (#28884)
- a784b901be tui: skip TUI in ui_rgb_attached (#29096)
- 19787d6057 ui: avoid ambiguity about last chunk when flushing halfway (#29718)
- 89fa1ee822 ui: flush ext_cmdline events before doing cmdpreview (#29062)
- 7055cd1238 ui: superfluous showmode / excessive grid_cursor_goto #29089
- 6802db7aa1 version: fix vim.version().prerelease
- 728f6c7c83 vim.text: remove assert from vim.text.hexdecode
- c3aef56199 win-msi: add bin to PATH per-machine after installation (#29099)
VIM PATCHES
--------------------------------------------------------------------------------
- fdf769fa86 0b74eec: runtime(stylus): remove remaining css code (vim/vim#14866)
- 29fd7432fd 74703f1: runtime(doc): remove obsolete Ex insert behavior (#29702)
- 891cc78179 7a85e34: runtime(doc): fix inconsistencies in :h file-searching (#29652)
- 704d33634e 8.2.0083: text properties wrong when tabs and spaces are exchanged
- 571e54e12c 8.2.0109: corrupted text properties when expanding spaces
- 7c055bd74b 8.2.3388: fnamemodify('path/..', ':p') differs from using 'path/../' (#29667)
- 9c91233a38 9.1.0414: Unable to leave long line with 'smoothscroll' and 'scrolloff'
- 34cc49bd72 9.1.0498: getcmdcompltype() interferes with cmdline completion (#29397)
- 259a620eb8 9.1.0512: Mode message for spell completion doesn't match allowed keys (#29437)
- f89d4ee6ce 9.1.0526: Unwanted cursor movement with pagescroll at start of buffer (#29569)
- 4ce293c2c3 9.1.0565: Stop directory doesn't work properly in 'tags'
- c467bfeb93 9.1.0566: Stop dir in findfile() doesn't work properly w/o trailing slash
- 576363a0fb 9.1.0567: Cannot use relative paths as findfile() stop directories
- ceb82a9396 9.1.0569: fnamemodify() treats ".." and "../" differently (#29673)
- 07de890de6 9.1.0580: :lmap mapping for keypad key not applied when typed in Select mode (#29693)
- b01202df15 9.1.0594: Unnecessary redraw when setting 'winfixbuf' (#29775)
- 804a94d300 9.1.0601: Wrong cursor position with 'breakindent' when wide char doesn't fit (#29793)
- a03cc83bfb df62c62: runtime(doc): grammar fixes in options.txt (#29729)
- fde5718e62 partial:9.0.0323: using common name in tests leads to flaky tests
REDACTOR
--------------------------------------------------------------------------------
- c35e040b7e replace deprecated vim.loop with vim.uv
- 3a354bfcaa lsp: reuse buf_detach_client logic in on_detach (#28939) (#29024)
- dffadc392e path.c: add nonnull attributes (#28829)
- db65017e60 tests: more global highlight definitions
- 3725db69ef tests: use more global highlight definitions
CI
--------------------------------------------------------------------------------
- 7400f9dfe5 adjust workflows to enable required checks
- 575136c178 always add `target:release` label when backporting
- 410f43c0ae bump backport action to version 3
- 9a2760a01f change label `backport` to `target:release`
- b94b341ef2 run workflows on release branches
- 0e81c62405 skip lintcommit workflow on release branches
TESTING
--------------------------------------------------------------------------------
- f03348472d add a test for #29119
- 18a36d3d9f do not set termguicolors in test runner
- 68513c2a89 fix reporting "no flush received" too early (#29735)
- 981548b7f7 remove checks for failed tests on Windows
- 65776124b1 starting and stopping treesitter highlight (#29546)
DOCUMENTATION
--------------------------------------------------------------------------------
- 891b235df0 document 'list' behavior when 'listchars' excludes "tab" (#29360)
- 8c00651131 fix more treesitter parsing errors
- 777e15fa61 update LSP quickstart (#28989)
- 6136326d63 lpeg: merge upstream changes
- f7d8650616 lsp: format the handwritten part #29295
Problem: Unable to move cursor to recently opened window.
Solution: Make sure uninitialized window is drawn before trying to move
the cursor to it.
(cherry picked from commit 89f9f168a5)
Problem: Marks whose position did not change with the action that
invalidated them (right_gravity = false) are not revalidated
upon undo.
Solution: Remove early return when restoring a marks saved position so
that it is still revalidated. Add "move" guards instead.
(cherry picked from commit 012db2b0f5)
Previously the label was not added if the backport PR was created
manually. The new code is also easier to maintain as it's close to other
label-related code.
(cherry picked from commit 4c788b1757)
Problem: Wrong cursor position with 'breakindent' when a double-width
character doesn't fit in a screen line (mikoto2000)
Solution: Include the width of the 'breakindent' properly.
(zeertzjq)
fixes: vim/vim#15289closes: vim/vim#15290b5d6b5caac
(cherry picked from commit 35b35cb93c)
Problem: :TOhtml doesn't properly handle virtual text when it has
multiple highlight groups. It also improperly calculates position offset
for multi-byte virt_text characters.
Solution: Apply the `vim.api.nvim_strwidth` broadly to properly
calculate character offset, and handle the cases where the `hl` argument
can be a table of multiple hl groups.