Commit Graph

10661 Commits

Author SHA1 Message Date
Aaron Tinio
d42f7ee9dc fix(lsp): trailing blank line when edit inserts past end of buffer #40133
Problem:
A text edit positioned entirely past the last buffer line, with
newText ending in a newline, leaves a stray blank line: the
past-the-end path appends the trailing empty fragment produced by
vim.split() and does not set has_eol_text_edit, so the end-of-buffer
cleanup is skipped. Formatting servers emit such edits whenever
formatting moves text to the end of a document.

Regression from ec94014cd1 (#20137), which split the past-the-end
fast path off the clamp path that sets the flag.

Solution:
Set has_eol_text_edit in the past-the-end path, like the adjacent
path that clamps end_row.
2026-06-10 23:25:13 +00:00
Tristan Knight
16549f2f40 fix(lsp): refresh codelens despite pending debounce #40154
Problem:
When a server sends workspace/codeLens/refresh while an automatic codelens
request is already scheduled, Nvim ignores the server refresh. This can leave
rendered codelens text stale until another buffer edit triggers a new request.

Solution:
Cancel the pending automatic request and send the server-requested refresh
immediately. This preserves request coalescing while giving explicit server
refreshes priority.
2026-06-10 19:18:48 -04:00
Barrett Ruth
7c53de949b fix(autocmd): redraw statusline after nvim_exec_autocmds() #40172
Problem:
Since 5181984d, `nvim_exec_autocmds({buf=…})` temporarily sets the
`buf`-window as current-window, and its statusline renders as
a "current-window statusline", regardless of the user's actual
current-window.

Solution:
Mark the statusline for redraw in `aucmd_restbuf()`, so it is redrawn
correctly after the event.

Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
2026-06-10 18:02:03 -04:00
tao
b49492f13c fix(option): set 'shell…' options based on detected shell #40031
Problem:
* 'shellcmdflag' states that its default value is set according to the
  value of 'shell', but this behavior is not yet implemented on Windows.
  The same applies to 'shellpipe', 'shellredir', and 'shellxquote'.
* On Windows, Git is often installed in paths containing spaces, and we
  still do not correctly resolve the sh executable name as described in
  'shell'.
* On Windows, the default value of 'shellslash' is always `false`,
  which causes Unix-like shells to interpret `\` in paths returned by
  some functions as escape charaters.

Solution:
Use a simple rule table to detect common shells (e.g. `cmd`,
`powershell`, shells whose names contain `csh` or `sh`) and apply
best-effort defaults, while leaving more complex scenarios to user
configuration.
2026-06-10 17:28:17 -04:00
tao
7bf2ab4b87 fix(path): nvim_get_runtime_file fails on DOS 8.3 filename #40144
Problem:
stdpath() may return a DOS 8.3 "shortened" filename, because Windows
truncates some long usernames into `6ch~N` names. Then features such
as `nvim_get_runtime_file` fail to find the file.                                         
                                                                                                                    
Analysis:
When expanding an 8.3 filename path like `C:/Users/ADMINI~1/AppData/*`,
we treat `~` as a special character and first check whether a directory
named `ADMINI~1` exists under `Users`. Since no such directory actually
exists, the expansion fails.                                                                                                    
                                                                                                                    
Solution:
Treat `~` as a literal character in `do_path_expand`. Since the `~/`
case is already handled in `gen_expand_wildcards`, any remaining `~` is
just a literal character and will later be escaped to `\~` by
`file_pat_to_reg_pat` if needed.
2026-06-10 07:46:55 -04:00
zeertzjq
cc056d78fb vim-patch:9.1.0581: Various lines are indented inconsistently (#40161)
Problem:  style: Various lines are indented inconsistently
Solution: Retab these lines and correct some comments.
          (zeertzjq)

closes: vim/vim#15259

d9be94cf03
2026-06-10 04:56:22 +00:00
Jan Edmund Lazo
b402a1221f vim-patch:9.1.0342: tests: test_taglist fails when 'helplang' contains non-english
Problem:  tests: test_taglist fails when 'helplang' contains non-english
Solution: Allow 1 or 2 tagfiles for now (Julio B)

related: vim/vim#14312
closes: vim/vim#14566

ae7e61c928

Co-authored-by: Julio B <julio.bacel@gmail.com>
2026-06-09 23:30:27 -04:00
Jan Edmund Lazo
1c8b988bf7 vim-patch:9.1.0095: tests: test_restricted() fails
Problem:  tests: test_restricted() fails
          (after: v9.1.0091)
Solution: Add a space before the pipecmd and the actual Vim command to
          run

52eb0b8677

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-06-09 23:17:46 -04:00
Jan Edmund Lazo
4465bb8bc8 vim-patch:9.0.2082: test_channel may fail because of IPv6 config issue
Problem:  test_channel may fail because of IPv6 config issues
Solution: Catch and skip the test, if getaddrinfo() fails with
          'Address family not supported'

Mark tests as skipped when ch_open encounters E901

On some of the Debian build systems, the IPv6 channel tests fail because
`ch_open('[::1]:<port>', ...)` raises the error "E901: getaddrinfo() in
channel_open(): Address family for hostname not supported".

This appears to happen because getaddrinfo() can't perform the reverse
lookup for the ::1, which is a config issue on that system.  Therefore,
instead of reporting a test failure, mark the test as skipped due to the
bad network config

closes: vim/vim#13473

43cb8e1c3b

Co-authored-by: James McCoy <jamessan@jamessan.com>
2026-06-09 22:34:24 -04:00
zeertzjq
51d59b2244 vim-patch:9.2.0605: tests: Test_screenpos() is flaky in GUI (#40156)
Problem:  Test_screenpos() fails intermittently in the GUI testgui CI
          job with "Expected {'row': 22} but got {'row': 23}".  In the
          GUI, the window height reported by getwininfo() before the
          final redraw can be stale, so the cached wininfo.height does
          not match the actual window height when the assertion runs.
Solution: Use winheight(winid) at assertion time so the height reflects
          the window state after the redraw.

closes: vim/vim#20457

781a91ac54

Co-authored-by: thinca <thinca@gmail.com>
2026-06-10 08:47:13 +08:00
zeertzjq
d4e6f92f52 vim-patch:9.2.0610: cindent: closing brace in a comment affects the next line's indent (#40155)
Problem:  A '}' inside a // line comment changes the indentation of the
          following line inside an enum or struct (rendcrx).
Solution: Stop scanning the line once a line comment is reached, so a brace
          inside the comment is no longer mistaken for an unmatched brace.

fixes:  vim/vim#20455
closes: vim/vim#20458

9dd86dff9b

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 07:37:08 +08:00
zeertzjq
fcd2adf8ae test: virt_lines_overflow=wrap with virt_lines_leftcol (#40147) 2026-06-09 02:30:38 +00:00
James McCoy
6c2f2b73eb fix(unittest): preprocess failure when __typeof declarations present #40145
On Debian's ppc64el build, the unittests are failing during preprocess
with

    test/unit/testutil.lua:298: declaration specifier expected near '__typeof' at line 298
    test/unit/testutil.lua:282: assertion failed!

Running with NVIM_TEST_PRINT_I set shows these lines as being the
problem when trying to preprocess test/unit/fixtures/posix.h.

    690     extern __typeof (strtold) strtold ;
    691     extern __typeof (strtold_l) strtold_l ;
    692     extern __typeof (strfroml) strfroml ;
    693     extern __typeof (qecvt) qecvt ;
    694     extern __typeof (qfcvt) qfcvt ;
    695     extern __typeof (qgcvt) qgcvt ;
    696     extern __typeof (qecvt_r) qecvt_r ;
    697     extern __typeof (qfcvt_r) qfcvt_r ;
2026-06-08 18:28:54 -04:00
zeertzjq
5e8fbfd043 perf(extmark): fix performance regression for non-wrapped virt lines 2026-06-08 22:37:43 +08:00
jreidx
d9aa06eed8 feat(extmark): virt_lines_overflow "wrap" and "auto"
Problem: Extmark has support for horizontal scrolling and truncating, but not wrapping.

Solution: Extend virt_lines_overflow flags to support "wrap" and "auto" based on proposed changes in #18282.
2026-06-08 22:19:25 +08:00
zeertzjq
bb93ad2258 test: add benchmark for drawing many non-wrapped virt lines (#40143) 2026-06-08 22:14:22 +08:00
zeertzjq
4ab670399b vim-patch:9.2.0596: cmdline completion popup cannot be scrolled with the mouse (#40142)
Problem:  In command-line completion with a popup menu ('wildoptions'
          contains "pum"), the info popup shown next to the menu could
          not be scrolled, unlike the Insert mode completion info popup
          which scrolls with the mouse wheel.
Solution: When the mouse pointer is on top of the info popup, scroll it
          with the mouse wheel in command-line mode as well, without
          closing the completion popup menu.

closes: vim/vim#20146
closes: vim/vim#20418

96dbab257a

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 20:53:10 +08:00
glepnir
3f37b230af vim-patch:9.2.0601: matchfuzzypos() returns garbage positions for long candidates (#40140)
Problem:  A needle that only matches past char 1024 gives an INT_MIN + 1
          score with unset positions, e.g.
          matchfuzzypos([repeat('a',1024)..'z'], 'az').
Solution: Drop the candidate when match_positions() returns SCORE_MIN.

closes: vim/vim#20435

52003f7fc1
2026-06-08 05:27:20 +00:00
Justin M. Keyes
ec7dab077b fix(vim.hl): range(0,…) highlight not cleared after buffer-switch #40130
Problem:
When `vim.hl.range(0, …, { timeout = N })` is called, the deferred
`range_hl_clear` captures `buf=0`, which resolves to an arbitrary
"current buffer" at timeout. This may cause a stale highlight that never
gets cleared.

Solution:
Resolve `buf=0` explicitly, before `range_hl_clear` captures it.
2026-06-06 10:26:12 +00:00
zeertzjq
9bdbc176eb vim-patch:9.2.0598: tests: Test_statusline() is flaky (#40128)
Problem:  Test_statusline() occasionally fails in CI, reading buffer text
          instead of the status line (e.g. '9012...' instead of '57,39').
Solution: In s:get_statusline() redraw unconditionally and read the screen
          cells directly with screenstring(), instead of relying on
          ScreenLines() whose own redraw! can process events and change the
          window layout between the redraw and reading the cells.  This
          matches the already-stable s:Assert_match_statusline() helper in
          test_statuslineopt.vim.

closes: vim/vim#20428

db3ce018b5

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-06 06:33:02 +02:00
glepnir
11b9e6f193 fix(option): allow empty/blank edges in 'winborder' #40112
Problem:
The comma form of 'winborder' is split with copy_option_part(),
whose skip_to_option_part() eats spaces after a comma, and empty
fields are rejected.

Solution:
Split the comma form literally on ',', keeping empty fields and
single-space fields.
2026-06-05 06:37:07 -04:00
zeertzjq
e887cfb3b5 vim-patch:9.2.0597: [security]: possible code execution with python complete (#40117)
Problem:  [security]: another possible code execution with python complete
          (David Carliez)
Solution: Strip default expressions and annotations from generated
          source for pythoncomplete and python3complete.

Github Security Advisory:
https://github.com/vim/vim/security/advisories/GHSA-65p9-mwwx-7468

c8c63673bc

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-06-05 04:59:44 +02:00
James McCoy
b7fd8cbd2b fix(test): only test for unibilium if a valid compilation string exists
Builds with -DNDEBUG do not contain the compilation string, so the test
will fail even if nvim is built with unibilium.

Similarly, zig builds only report "Compilation: TODO", so they also fail
the test even when build with unibilium

Detect both scenarios and skip the test, rather than failing it.
2026-06-04 17:29:28 -04:00
bfredl
3f67dabcc7 fix(test): check for SIGINT between tests
when running `zig build functionaltest`, it might
take a while until the test harness nvim instance checks
for interrupts, which causes a lot of tests to keep running after
CTRL+C. Check after each test instead
2026-06-04 11:33:35 +02:00
bfredl
aceb0627c8 fix(build.zig): do not depend on b.install_path on configure time
This is in preparation of zig 0.17 where b.install_path is no
longer known inside `pub fn build()`.

Builds which should hardcode a runtime path into the binary has to specify it.
We could use a nlua0 helper to encode the install path at build time but
I think this is cleaner anyway. (like currently the appimage still
encodes a temporary build path which is nonsensical, it is better to
just include none)

Similarily b.args will not be available anymore (there will just
be an opaque pass-through)
2026-06-04 11:33:35 +02:00
glepnir
5e3b655ad4 vim-patch:9.2.0591: 'scrolljump' ignored when scrolling up (#40106)
Problem:  srolljump=-100 only scrolls half a page going up, but works
          fine going down. update_topline() always falls back to
          scroll_cursor_halfway() when the cursor is far above topline.
Solution: Only center when sj is smaller than half the window. Otherwise
          call scroll_cursor_top like the downward path does (glepnir).

fixes:  vim/vim#1527
closes: vim/vim#20366

a4a60c0fdb
2026-06-04 06:21:59 +02:00
Justin M. Keyes
85b607d797 Merge #40088 from justinmk/doc2
docs: misc, lsp
2026-06-03 16:57:13 -04:00
zeertzjq
fa5ed94852 vim-patch:9.2.0589: filetype: xinitrc files are not recognized (#40102)
Problem:  filetype: xinitrc files are not recognized
Solution: Detect xinitrc and xserverrc files as sh filetype
          (Enrico Maria De Angelis)

Reference:
https://wiki.archlinux.org/title/Xinit#Configuration

closes: vim/vim#20419

5b76ddcc52

Co-authored-by: Enrico Maria De Angelis <enricomaria.dean6elis@gmail.com>
2026-06-03 22:12:11 +02:00
Tomasz N
2f577f7c5c fix(messages): no prompt/newlines for ext_messages filter command #39786)
Problem:  Redundant newlines and "Press any key" prompt with ext_messages
          for Visual filter command.

Solution: Remove newlines and prompt with ext_messages.
2026-06-03 10:20:28 -04:00
Justin M. Keyes
5cff3c0b97 refactor: drop os_fileid_equal_fileinfo 2026-06-03 12:26:31 +02:00
tao
13b2b14275 fix(path): prevent infinite loop when re-editing file without drive-letter
Problem:
Edit a file with a drive-letter path, then re-edit it without the drive letter
and colon. This cause `path_fnamencmp` to loop infinitely as `len` never
reaches 0, while `c1` and `c2` are already NUL.

Commit e18a578 accidentally used || before `(p_fic`, commit 4bcee96 fixed that,
but also moved the NUL check into a grouped condition. The bug remained hidden
because there weren't any cases where strings had different lengths and c1 and
c2 could both reach NUL. `c:/foo` vs `/foo` happens to be such a case, which is
why the infinite loop finally showed up.

Solution:
Break the loop when either `c1` or `c2` is NUL.
2026-06-02 18:59:13 -04:00
Artem Krinitsyn
738cd366f9 fix(diagnostic): stack _tags hl-groups in a single extmark #38654
Problem:
Diagnostic highlight groups were applied by iterating and calling
`vim.hl.range` for each group individually. That resulted in multiple
extmarks with the same priority being created separately, which does not
allow `DiagnosticUnnecessary` and `DiagnosticDeprecated` with matching
options override `Diagnostic*` styling.

Solution:
Pass the list of hl-groups to `vim.hl.range` so they are applied
together in the correct order.
2026-06-02 18:36:03 -04:00
Yi Ming
cf9ad39267 fix(lsp): handle requests with null id #40073
Problem:
PR #38340 prevented messages we receive with id:null from being
incorrectly classified as notifications, but caused us to ignore all
messages with id:null, including requests.

Solution:
Handle requests with id:null. When we receive a request, we only need to
respond based on the `method` and `param`.

(The original so-called `notification_received` in the test was actually
semantically `request_or_notification_received`.)
2026-06-02 17:39:56 -04:00
zeertzjq
5a8e4cc5fa vim-patch:9.2.0581: After maximizing and deleting the quickfix buffer, window height is wrong (#40092)
Problem:  After maximizing and deleting the quickfix buffer, window
          height is wrong (tertium)
Solution: Reset the winfixheight option when a quickfix buffer is
          deleted from a window (Yegappan Lakshmanan)

fixes:  vim/vim#3378
closes: vim/vim#20403

07f055f579

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2026-06-02 18:30:20 +00:00
Justin M. Keyes
70f8c7bbf3 Merge #40057 from luukvbaal/hidenodraw
perf(redraw): don't redraw hidden windows
2026-06-02 08:51:08 -04:00
bfredl
772cfcf267 Merge pull request #39074 from bfredl/retromania
build(zig): run oldtests in zig builds (RETROMANIA HYPERDRIVE)
2026-06-02 12:34:40 +02:00
bfredl
49dc3d9424 build(zig): run oldtests in zig builds with new lua runner
The new lua based runner replaces Makefile, runnvim.sh and runnvim.vim

As it happens, we run a `--headless` nvim inside a `:terminal` layer,
this is pointless.
Also there is still a lot remnants for oldesttests, but we don't
have any except for test1.in which just checks the environment
for following, nonexistant oldesttests. so just skip that.

For now, the actual vimscript code which runs in vim-under-test is
completely unchanged.

On macos, luajit is finally working with the latest ziglua master.
Also fix some minor bugs regarding locales, such as incorrect
HAVE_WORKING_LIBINTL checks
2026-06-02 11:12:11 +02:00
glepnir
a5d4b4e0fc vim-patch:9.2.0585: line number wrong after undoing a deletion in quickfix buffer (#40081)
Problem:  Deleting a quickfix line and undoing it leaves the entry
          pointing one line below where it should.
Solution: Don't shift already cleared entries in qf_mark_adjust.

closes: vim/vim#20379

64982d6010
2026-06-02 07:30:12 +02:00
glepnir
6b6efb37eb vim-patch:9.2.0583: completion: indent not ignored for fuzzy line completion (#40080)
Problem:  Indent is not stripped in whole-line completion (CTRL-X
          CTRL-L).
Solution: Skip the matched line's indent for whole-line matches in
          search_for_fuzzy_match (glepnir).

closes: vim/vim#20405

9fa5f64135
2026-06-02 07:28:23 +02:00
zeertzjq
edcaf1887a vim-patch:partial:9.2.0573: Vim9: missing EX_WHOLE on some block keywords (#40071)
Problem:  Several Vim9 keywords lack EX_WHOLE and can be shortened in
          Vim9 script, inconsistent with endif/enddef/endfor/endwhile/
          endtry which already have it.  The error from :endd in a
          nested function also hardcodes "enddef" instead of reporting
          what the user typed.  fullcommand("ho") returns "horizontal"
          even though :ho is below the documented 3-char minimum.
Solution: Add EX_WHOLE to :class, :def, :endclass, :endinterface,
          :endenum, :public and :static.  In get_function_body() pass
          the user-typed command to the error message.  Force :ho to
          CMD_SIZE in find_ex_command() so fullcommand() reflects the
          modifier minimum.  Extend tests and documentation accordingly
          (Peter Kenny).

fixes:  vim/vim#20032
closes: vim/vim#20191

38d9a16eba

Co-authored-by: Peter Kenny <github.com@k1w1.cyou>
2026-06-01 01:04:30 +00:00
zeertzjq
71a02e261d vim-patch:9.2.0575: tests: filetype test for v9.2.0557 can be improved (#40070)
Problem:  tests: filetype test for v9.2.0557 can be improved
Solution: Use a correct Kawasaki robot AS test file
          (Patrick Meiser-Knosowski)

related: vim/vim#20370
closes:  vim/vim#20387

0878792046

Co-authored-by: Patrick Meiser-Knosowski <knosowski@graeffrobotics.de>
2026-06-01 08:46:34 +08:00
Luuk van Baal
9cf684ed7d fix(float): validate conflicts for nvim_win_set_config()
Problem:  nvim_win_set_config() does not error on flags not allowed for
          non-floating windows.
          `hide` should not be allowed for non-floating windows.
Solution: Check that a window is a split when reconfiguring.
          Error when trying to hide a split window.
2026-06-01 01:02:01 +02:00
Luuk van Baal
1ca65faca6 test(screen_basic_spec): use default highlight attrs 2026-05-31 23:18:53 +02:00
Luuk van Baal
253378f86a perf(redraw): don't redraw hidden windows
Problem:  Hidden windows are redrawn unnecessarily.
Solution: If a window is hidden, don't bother drawing it.
2026-05-31 23:15:39 +02:00
zeertzjq
3f4a108cf4 vim-patch:9.2.0568: pythoncomplete: g:pythoncomplete_allow_import had no effect (#40067)
Problem:  The security patch 9.2.0561 added a vim.eval() call inside
          Completer.evalsource() to honor g:pythoncomplete_allow_import.
          But the 'vim' module is only imported inside the outer
          vimcomplete() / vimpy3complete() function, not at the script's
          top level, so referring to it from a Completer method raises
          NameError.  The surrounding bare 'except' silently swallows
          the error and leaves allow_imports at 0, meaning the opt-in
          never takes effect -- 'import os' (and any other
          buffer-level import) is always skipped, no candidates are
          produced for 'os.<...>' and
          Test_popup_and_preview_autocommand() fails on the Windows
          CI matrix (Linux skips the test because Python 2 is absent).
Solution: Re-import 'vim' at the top of evalsource() in both
          pythoncomplete.vim and python3complete.vim so the eval reads
          the global, and set g:pythoncomplete_allow_import = 1 in the
          test (it is the opt-in intended for callers that trust the
          buffer contents) (thinca).

closes: vim/vim#20386

868ad62cb8

Co-authored-by: thinca <thinca@gmail.com>
2026-05-31 13:00:32 +00:00
zeertzjq
54905409f1 vim-patch:9.2.0566: <C-w>f duplicates window if do_ecmd() is aborted (#40061)
Problem:  If got_int is true when win_close() is called, it unexpectedly
          fails in the branch that detects failure in apply_autocmds().
          This causes wingotofile in do_window() to duplicate current
          window when do_ecmd() is aborted with got_int.
Solution: Fix do_window() to save the got_int value before trying to
          close the split window (Yohei Kojima).

Steps to reproduce:
 1. run `touch a && touch .a.swp && echo a > b && vim b`
 2. Type `<C-w>f`
 3. In the warning dialogue, type `a` to abort
 4. Current window is duplicated

closes: vim/vim#20382

113e507cdd

Co-authored-by: Yohei Kojima <yk@y-koj.net>
2026-05-31 01:21:03 +00:00
glepnir
70cfeabe23 fix(float): title/footer shows printable control chars #40047
Problem:
Literal tab (or other control char) in a float title/footer is
not made printable, so it renders incorrectly instead of as "^I".

Solution:
Normalize title/footer text for display like 'statusline'
tab to "^I", parameterize parse_virt_text() with untab
and recompute the width.
2026-05-30 10:02:16 -04:00
luukvbaal
6b799ee40a fix(autocmd): never show autocommand windows #40032
Problem:  Redrawing in an autocommand that uses an autocommand window
          (more common since 5181984d) can result in flickering.
Solution: Hide autocommand windows.
2026-05-30 06:55:16 -04:00
zeertzjq
37abcdd044 vim-patch:9.2.0562: filetype: SGF files are not recognized
Problem:  filetype: SGF files are not recognized
Solution: Detect *.sgf as sgf filetype
          (Borys Lykah)

Reference:
https://www.red-bean.com/sgf/index.html

closes: vim/vim#20349

dda45ba88f

Co-authored-by: Borys Lykah <lykahb@fastmail.com>
2026-05-30 11:49:08 +08:00
zeertzjq
8b5a8c12cd vim-patch:9.2.0560: filetype: busybox shebang lines are not recognized
Problem:  filetype: busybox shebang lines are not recognized
Solution: Add filetype detection pattern for #!busybox sh, detect
          ash as shell in the shebang lines (Christoffer Aasted).

closes: vim/vim#20358

69f402e97f

Co-authored-by: Christoffer Aasted <dezzadk@gmail.com>
2026-05-30 11:41:23 +08:00