Commit Graph

9785 Commits

Author SHA1 Message Date
jdrouhard
8ed68fda50 feat(lsp): semantic token range improvements #37451
* cache all tokens from various range requests for a given document
  version
  - all new token highlights are merged with previous highlights to
    maintain order and the "marked" property
  - this allows the tokens to stop flickering once they've loaded once
    per document version
* abandon the processing coroutine if the request_id has changed instead
  of relying only on the document version
  - this will improve efficiency if a new range request is made while a
    previous one was processing its result
* apply new highlights from processing coroutine directly to the current
  result when the version hasn't changed
  - this allows new highlights to be immediately drawable once they've
    processed instead of waiting for the whole response to be processed
    at once
* rpc layer was changed to provide the request ID back in success
  callbacks, which is then provided as a request_id field on the handler
  context to lsp handlers
2026-01-27 08:56:52 -05:00
zeertzjq
b88b7f9591 fix(terminal): wrong colors with nvim_open_term() in non-curbuf (#37579)
Problem:  Wrong colors with nvim_open_term() in non-current buffer.
Solution: Pass the buffer to get_config_string().
2026-01-27 06:59:23 +00:00
zeertzjq
9540e7470b fix(terminal): possible heap-use-after-free during Nvim exit
Usually, terminal_close() calls refresh_terminal(), which allocates the
scrollback buffer, and term_may_alloc_scrollback() in terminal_open()
won't dereference the buffer. However, refresh_terminal() is not called
during Nvim exit, in which case a heap-use-after-free may happen if
TermOpen wipes buffer. Check for non-NULL buf_handle to avoid that.
2026-01-27 13:12:15 +08:00
zeertzjq
b4039ec0b0 fix(terminal): don't allow b:term_title watcher to delete buffer 2026-01-27 12:45:49 +08:00
zeertzjq
b6befc7b03 fix(terminal): losing scrollback when TermOpen polls for events (#37573)
Problem:  When TermOpen polls for enough events to use the scrollback
          buffer, scrollback is lost until the next terminal refresh.
Solution: Allocate the scrollback buffer when it's needed.
2026-01-27 03:46:54 +00:00
luukvbaal
d30d91f3a4 fix(ui): only internal messages are unsafe #37462
Problem:  Fast context for msg_show event inhibits vim.ui_attach from
          displaying a stream of messages from a single command.

Solution: Remove fast context from msg_show events emitted as a result
          of explicit API/command calls. The fast context was originally
          introduced to prevent issues with internal messages.
2026-01-26 18:18:51 -05:00
luukvbaal
96e1acfa42 fix(messages): add "list_cmd" kind to :colorscheme #37561
Problem:  No kind for :colorscheme message.
Solution: Assign it the "list_cmd" kind.
2026-01-26 11:56:39 -05:00
zeertzjq
d982c00846 vim-patch:9.1.2110: filetype: skhd files are not recognized
Problem:  filetype: skhd files are not recognized
Solution: Detect .skhdrc and skhdrc as skhd filetype,
          include a syntax and filetype plugin, add syntax tests
          (Kiyoon Kim)

Add syntax highlighting for skhd (simple hotkey daemon for macOS)
configuration files. Includes filetype detection for skhdrc and
.skhdrc files.

Reference:
- https://github.com/asmvik/skhd

closes: vim/vim#19235

e5f61842b5

Co-authored-by: Kiyoon Kim <kiyoon@users.noreply.github.com>
2026-01-26 07:00:32 +08:00
zeertzjq
798ee64287 vim-patch:9.1.2109: filetype: NetLinx fires are not recognized
Problem:  filetype: NetLinx fires are not recognized
Solution: Detect *.axs and *.axi as netlinx filetype
          (kb).

Reference:
- https://www.amx.com/en/site_elements/amx-language-reference-guide-netlinx-programming-language
- https://kielthecoder.com/2021/06/11/netlinx-getting-started/

closes: vim/vim#19249

6963e3b8bf

Co-authored-by: kb <kim@simple.industries>
2026-01-26 06:42:36 +08:00
zeertzjq
02760a30ce vim-patch:9.1.1908: tests: test_crash.vim times out in CI ASAN builds
Problem:  tests: test_crash.vim times out in CI ASAN builds
Solution: Increase timeout for ASAN or Valgrind runs

closes: vim/vim#18725

89f0a3a574

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-24 10:04:44 +08:00
zeertzjq
73f2286f08 vim-patch:9.1.1370: CI Tests favor GTK2 over GTK3
Problem:  CI Tests favor GTK2 over GTK3
Solution: Install GTK3 dependencies and debug packages for CI workflows,
          update ASAN suppression list, update required dependency
          checks for the tests (Drew Vogel)

closes: vim/vim#17253

ea67ba718d

Cherry-pick test_match.vim changes from patch 9.0.0626.

Co-authored-by: Drew Vogel <dvogel@github>
2026-01-24 10:04:44 +08:00
zeertzjq
08e193633b vim-patch:9.0.1480: using popup menu may leave text in the command line
Problem:    Using popup menu may leave text in the command line.
Solution:   Clear the command line if the popup menu covered it. (Luuk van
            Baal, closes vim/vim#12286)

dcd40cfca0

No code change is need in Nvim and testing is already covered by
test/functional/ui/popupmenu_spec.lua.

Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
2026-01-24 10:04:44 +08:00
zeertzjq
3ac981e838 vim-patch:9.0.1066: test function name is wrong
Problem:    Test function name is wrong.
Solution:   Rename to what is actually being tested. (closes vim/vim#11712)

67f3094397
2026-01-24 10:04:44 +08:00
zeertzjq
f60051e00d vim-patch:9.0.0874: using freed memory when executing unmenu at more prompt
Problem:    Using freed memory when executing unmenu at the more prompt.
Solution:   Do not clear menus while listing them. (closes vim/vim#11439)

920d311480

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-01-24 10:04:44 +08:00
zeertzjq
cc95a7d8b8 vim-patch:8.2.4738: Esc on commandline executes command instead of abandoning it
Problem:    Esc on commandline executes command instead of abandoning it.
Solution:   Save and restore KeyTyped when removing the popup menu.
            (closes vim/vim#10154)

11a57dfd16

No code change is needed in Nvim as Nvim doesn't call update_screen() to
redraw pum.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-01-24 10:04:44 +08:00
zeertzjq
e0b724de09 vim-patch:9.1.2105: tests: not enough tests for using plain_vgetc() (#37521)
Problem:  Not enough tests for using plain_vgetc().
Solution: Add tests for using plain_vgetc() during various commands.
          (zeertzjq)

closes: vim/vim#19236

2b6bdbc697
2026-01-24 00:04:33 +00:00
zeertzjq
f10a1dcf4d vim-patch:9.1.2107: :normal may change cmdline history (#37523)
Problem:  :normal may change cmdline history if the keys don't
          explicitly leave Cmdline mode (after 9.1.1872).
Solution: Check ex_normal_busy (zeertzjq)

closes: vim/vim#19237

85241020e8
2026-01-23 23:57:49 +00:00
zeertzjq
5a354db7fa vim-patch:9.1.2108: tests: Test_foldtextresult_rightleft() does not restore 'columns'
Problem:  Test_foldtextresult_rightleft() does not restore 'columns'
          (after v9.1.2102)
Solution: Save and restore the value of 'columns' (zeertzjq).

related: vim/vim#19220
closes:  vim/vim#19234

4fcbc70fb1
2026-01-24 06:56:50 +08:00
zeertzjq
cd624f24f6 vim-patch:9.1.2103: tests: test_fold.vim leaves swapfiles behind
Problem:  tests: test_fold.vim leaves swapfiles behind
Solution: Close open buffer using :bw! instead of :close!

10b272c126

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-24 06:56:09 +08:00
zeertzjq
b3242af187 vim-patch:9.1.2102: foldtext not reversed and cut off in 'rightleft' mode
Problem:  foldtext not reversed and cut off in 'rightleft' mode
          (bfredl)
Solution: Fix the rightleft redrawing logic (Sergey Vlasov)

fixes:  vim/vim#2659
closes: vim/vim#19220

b51ac5e378

Co-authored-by: Sergey Vlasov <sergey@vlasov.me>
2026-01-24 06:55:54 +08:00
glepnir
589232c0e0 fix(extmark): wrong eol_right_align width calculation (#37034)
Problem: Multiple eol_right_align virtual texts with different widths
are incorrectly positioned. The lookahead loop uses `item` instead of
`lookaheadItem` when checking kind and accessing data, causing all
items to use the first item's width.

Solution: Use `lookaheadItem->kind` and `lookaheadItem->data.vt`
instead of `item->kind` and `item->data.vt` in the lookahead loop.
2026-01-23 08:35:43 +00:00
zeertzjq
196df35cca fix(terminal): <Ignore> should be no-op (#37494) 2026-01-22 09:26:22 +08:00
zeertzjq
25ce44845d fix(terminal): restore options properly when switching buffer (#37485) 2026-01-21 18:42:47 +08:00
zeertzjq
1883fe39bd test: fix some type warnings (#37483) 2026-01-21 15:11:47 +08:00
glepnir
c556972ae1 fix(api): auto-load buffers in nvim_buf_set_* operations (#35046)
fix(api): auto-load buffers in nvim_buf_set_* operations

Problem: Setting marks, lines, or text on unloaded buffers fails because
ml_line_count is not accurate until the buffer is loaded.

Solution: Add require_loaded_buffer() helper and use it in write operations
(nvim_buf_set_lines, nvim_buf_set_text, nvim_buf_set_mark). These now
auto-load buffers as needed.
2026-01-21 14:17:44 +08:00
Kevin Goodsell
2c2203c040 test: fix has() test failure (#37480)
Problem: has("terminfo") test fails on local runs because it expects
"HAVE_UNIBILIUM " in the :version info to mean that nvim was built
without unibilium.

Solution: Assume nvim is built with unibilium if HAVE_UNIBILIUM is
present in the version string and is NOT followed by 0, false, or off.

This isn't affecting CI runs because when the test detects that it is
running in CI it doesn't use the :version string at all.

Resolves https://github.com/neovim/neovim/issues/37456
2026-01-21 12:02:20 +08:00
zeertzjq
1949452bd3 fix(tui): avoid using uv_pipe_t as uv_tty_t (#37479)
Check tui->out_isatty before accessing tui->output_handle.tty.
2026-01-21 11:53:18 +08:00
Tommy Guo
103ddaf9ae fix(lua): correct line number reporting for options set in coroutines (#37463) 2026-01-21 02:18:33 +00:00
zeertzjq
d3aae6172a test: fix flaky tests (#37478)
* test(core/channels_spec): fix flaky test

Always use expect_stdout() to check PTY output.

* test(autocmd/termxx_spec): fix flaky test

Usually the Ctrl-C cancels the following :qa!, but sometimes it doesn't,
and Nvim exits before feed() returns. Instead make sure that :qa! always
reaches Nvim and use expect_exit().
2026-01-21 08:41:00 +08:00
zeertzjq
87276db7f9 vim-patch:9.1.2100: filetype: tiltfiles are not recognized (#37477)
Problem:  filetype: tiltfiles are not recognized
Solution: Detect Tiltfiles.* and *.tiltfiles as tiltfile  filetype.
          (Luis Davim)

Reference:
- https://docs.tilt.dev/api.html

fixes:  vim/vim#19214
closes: vim/vim#19218

ff0e5d994c

Co-authored-by: Luis Davim <luis.davim@gmail.com>
2026-01-21 07:34:51 +08:00
zeertzjq
15b9118ac0 test: fail CI if .nvimlog is not empty (#37470)
This will prevent adding passing tests which logs errors in .nvimlog.

Close #28323
Related: https://github.com/neovim/neovim/pull/27660#issuecomment-2035738597

Co-authored-by: dundargoc <gocdundar@gmail.com>
2026-01-20 20:56:06 +08:00
zeertzjq
6da968dd7f test(core/server_spec): check error in logfile (#37469) 2026-01-20 06:57:10 +00:00
James Fotherby
bfe9fa0f8e fix(socket): remove stale socket files (#37378)
Problem:
Crashed Nvim leaves socket files. Subsequent starts fail with "address already in use".

Solution:
On bind failure, test socket liveness via connect(). Remove if stale, retry bind().

Fixes #36581
2026-01-20 13:59:43 +08:00
glepnir
0712a9c87b fix(pum): separate scrollbar from shadow border (#37448)
Problem:
With shadow border, scrollbar and border overlap. Shadow's right border
starts from the second row (offset by 1), but scrollbar renders on every
row including the first. If they share a column, the first row shows
scrollbar where shadow hasn't started yet, causing misalignment.

Solution:
Separate scrollbar from the shadow's right border.
2026-01-19 19:39:48 -08:00
zeertzjq
64057d266c vim-patch:9.1.2098: Crash with 'wildmenu' when typing Ctrl-Y after Ctrl-A (#37466)
Problem:  Crash with 'wildmenu' when typing Ctrl-Y after Ctrl-A
          (after 9.1.1714) (fizz-is-on-the-way).
Solution: Check if there are matches before applying one (zeertzjq).

closes: vim/vim#19210

311b98d942
2026-01-19 23:36:57 +00:00
zeertzjq
8133760c98 test: add tests for #14379 2026-01-20 07:09:15 +08:00
zeertzjq
b4e602dde5 vim-patch:9.1.2095: :wqall! doesn't quit when using :quit in BufWritePost
Problem:  :wqall! doesn't quit when using :quit in BufWritePost
          (after 8.0.1190).
Solution: Restore old value of "exiting" when calling not_exiting()
          instead of always resetting it to FALSE (zeertzjq).

related: vim/vim#2205
closes:  vim/vim#19212

e803ad1c56
2026-01-20 07:09:15 +08:00
zeertzjq
7470e63260 vim-patch:9.1.2097: TabClosedPre may be triggered twice for the same tab page
Problem:  TabClosedPre may be triggered twice for the same tab page when
          closing another tab page in BufWinLeave (after 9.1.1211).
Solution: Store whether TabClosedPre was triggered in tabpage_T
          (zeertzjq).

Also fix the inconsistency that :tabclose! triggers TabClosedPre after
a failed :tabclose, but :close! doesn't even if there is only one window
in the tab page.

closes: vim/vim#19211

9168a04e0c
2026-01-20 06:23:11 +08:00
zeertzjq
30bcb25341 vim-patch:9.1.2093: heap-use-after-free when wiping buffer in TabClosedPre
Problem:  heap-use-after-free when wiping buffer in TabClosedPre.
Solution: Check window_layout_locked() when closing window(s) in another
          tabpage (zeertzjq).

closes: vim/vim#19196

8fc7042b3d
2026-01-20 06:23:11 +08:00
zeertzjq
da20804a6a vim-patch:9.1.1325: tests: not checking error numbers properly
Problem:  tests: not checking error numbers properly.
Solution: Add a trailing comma to avoid matching a different error
          number with the same prefix (zeertzjq)

closes: vim/vim#17159

67fe77d272
2026-01-20 06:23:11 +08:00
zeertzjq
0d3ed7904a vim-patch:9.1.1211: TabClosedPre is triggered just before the tab is being freed
Problem:  TabClosedPre is triggered just before the tab is being freed,
          which limited its functionality.
Solution: Trigger it a bit earlier and also on :tabclose and :tabonly
          (Jim Zhou)

closes: vim/vim#16890

bcf66e0141

Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com>
2026-01-20 06:23:11 +08:00
zeertzjq
e3990f8643 vim-patch:9.1.1202: Missing TabClosedPre autocommand
Problem:  Missing TabClosedPre autocommand
          (zoumi)
Solution: Add the TabClosedPre autcommand (Jim Zhou).

fixes: vim/vim#16518
closes: vim/vim#16855

5606ca5349

Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com>
2026-01-20 06:23:11 +08:00
zeertzjq
df65f87fd7 vim-patch:partial:8.2.3149: some plugins have a problem with the error check
Problem:    Some plugins have a problem with the error check for using
            :command with -complete but without -nargs.
Solution:   In legacy script only give a warning message.

cc7eb2aa7a

Align tests with Vim only.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-01-20 06:23:10 +08:00
luukvbaal
8bdfd286e5 fix(messages): adjust msg_show "empty" kind logic (#37427)
Problem:  A message ending in an unprintable character may emit a
          msg_show event with the "empty" kind. No empty message event
          for echom "".
Solution: Adjust conditions for emitting "empty" msg_show events.
2026-01-19 17:15:44 +01:00
Christian Clason
c52f6eb49a vim-patch:9.1.2094: filetype: tiger files are not recognized
Problem:  filetype: tiger files are not recognized
Solution: Detect *.tig files as tiger filetype
          (Christian Clason).

Reference:
- https://www.cs.princeton.edu/~appel/modern/

closes: vim/vim#19202

eb53ed5de0

Co-authored-by: Christian Clason <c.clason@uni-graz.at>
2026-01-18 23:33:22 +01:00
Emanuel Krollmann
f36dd7557a fix(autocmd): heap UAF with :bwipe in Syntax autocmd
Problem:
Creating an autocommand which executes `:bwipe` on the Syntax event
causes a heap-use-after-free.

Solution: set BF_SYN_SET flag before applying autocommands
2026-01-18 17:56:34 +00:00
glepnir
5a65321684 fix(pum): text overflows into border on truncation (#37438)
Problem:
When text is too long, it overflows into the border. This happens because
grid_line_maxcol includes border columns, so grid_line_puts can write
there.

Solution:
Truncate string to available width when need_fcs_trunc is set.
2026-01-18 08:55:30 +00:00
zeertzjq
41068c77aa fix(normal): assertion failure with "gk" in narrow window (#37444)
When width1 and width2 are negative the assertion may fail. It seems
that adding a negative value to w_curswant won't cause any problems, so
just change the assertion.
2026-01-18 11:46:13 +08:00
Sean Dewar
a5e5ec8910 fix(api): parse_expression crash with unopened ] and node
Problem: nvim_parse_expression null pointer dereference with unmatched ]
followed by a node.

Solution: if ast_stack was empty, set new_top_node_p to top of the stack after
pushing the list literal node; similar to what's done for curlies.

This bug was originally found by a Matrix user, but I couldn't remember how to
trigger it... Ran into the other crash while finding a repro. :P
2026-01-17 13:22:55 +00:00
Sean Dewar
5226801be2 fix(api): parse_expression crash with ident and curly
Problem: nvim_parse_expression null pointer dereference when parsing an
identifier followed by { with "highlight" parameter set to false.

Solution: only set opening_hl_idx if pstate->colors is not NULL.

Not added to parser_tests.lua as that uses highlight = true.
2026-01-17 13:22:55 +00:00