Commit Graph

37554 Commits

Author SHA1 Message Date
bfredl
0abc9ccc19 Merge pull request #40772 from Rawan10101/wasm-browser
feat(wasm-emcc): add browser support for Neovim
2026-08-04 12:11:17 +02:00
Barrett Ruth
a29297ac53 docs(api): buffer columns are byte indices #41137 2026-08-04 05:19:54 -04:00
Rocco Vaccone
d0644230f1 fix(lsp): ignore (and log once) invalid documentSelector globs #41055
Problem:
Client:_get_registrations() errors if a documentSelector pattern is not
a valid glob (e.g. "**/**.dart" from dartls). The error discards
already-matched registrations and propagates to supports_method() and
the client/registerCapability handler, disabling capabilities unrelated
to the offending pattern.

Solution:
Skip invalid globs. Treat them as non-matching, and log once per client.

(Similar approach was taken for filewatcher globs: 4d9e5acfb5)
2026-08-04 05:14:15 -04:00
Justin M. Keyes
c875b16714 Merge #41112 from erdivartanovich/dir-failed-open-recovery 2026-08-04 05:04:07 -04:00
zeertzjq
30b4c1b40d fix(ctx): missing options copy when loading hidden buffer #41149
It's necessary to copy the global 'fileencoding' to the buffer-local
value before entering the buffer, otherwise 'fileencoding' is changed
when reading the file, which will mark the file as modified.
2026-08-04 04:50:36 -04:00
Justin M. Keyes
434792787b Merge #41093 from barrettruth/feat/zip-finish 2026-08-04 04:46:33 -04:00
Christian Clason
942daa05c9 build(deps): bump luajit to 1edc3e52b 2026-08-04 10:14:18 +02:00
zeertzjq
8d2b50c0ce vim-patch:c0da866: runtime: Add TOML entry to the syntax menu (#41145)
fixes:  vim/vim#20927
closes: vim/vim#20930

c0da86685a

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-08-04 08:41:13 +08:00
zeertzjq
6303d3680c vim-patch:9.2.0906: slow transstr() with long strings (#41144)
Problem:  transstr() appends with STRCAT()/STRLEN() from the start of
          the result on every iteration, making it quadratic to the
          length of the string.
Solution: Keep a tail pointer and append at it. (Samuel Schlesinger).

closes: vim/vim#20925

124c86868c

Co-authored-by: Samuel Schlesinger <sgschlesinger@gmail.com>
2026-08-04 08:40:46 +08:00
zeertzjq
21a0227d2f vim-patch:9.2.0904: "zb" scrolls incorrectly with cursor just above fold (#41143)
Problem:  "zb" scrolls incorrectly with cursor just above fold.
Solution: Handle boff.lnum being set to the last line of a fold
          (zeertzjq).

With the cursor just above fold, botline_forw() moves boff.lnum to the
last line of the fold, but curwin->w_botline is at the first line of the
fold, so the boff.lnum == curwin->w_botline condition never holds.

Instead, check that boff.lnum has just moved to or past w_botline by
comparing its previous value with w_botline.

Also make a similar change to the loff.lnum check above for symmetry.
That one doesn't change behavior, as topline_back() sets loff.lnum to
the first line of a fold.

related: neovim/neovim#41122
closes:  vim/vim#20923

aee686334c
2026-08-03 23:43:09 +00:00
Barrett Ruth
755abbc8d5 fix(zip): only refuse a cwd unzip on Windows 2026-08-03 15:35:30 -05:00
Barrett Ruth
886a270e7f refactor(zip)!: address entries with zip:// paths
Problem:
`zipfile://{archive}::{entry}` is ambiguous: `::` is legal in both an
archive path and an entry path, so the separator cannot be identified.
Splitting at the last `::` reads archives correctly but breaks entries
that contain it, and the plugin then emits buffer names it cannot read
back.

Solution:
Address entries as `zip://{archive}/{entry}`, joining the two paths.
Resolve the split by walking components: the first one that is a regular
file is the archive, because a regular file cannot have children on disk.
Entry paths may then contain any character, and no escaping is needed.

zipPlugin.vim keeps its own scheme, so the Java ftplugin emits whichever
form matches the active plugin until the legacy package is removed.
2026-08-03 15:22:25 -05:00
Barrett Ruth
8787b8b9b6 fix(zip): do not run unzip from the current directory
Problem:
Windows searches the current directory before $PATH, so opening an archive
in a directory that also contains an `unzip` executable runs that one. The
legacy plugin refused this; the port dropped the check.

Solution:
Refuse to run `unzip` when it resolves to the current directory.
2026-08-03 15:22:25 -05:00
Justin M. Keyes
794886aae7 Merge #41088 from barrettruth/feat/zip-health-encryption
feat(zip): checkhealth and encrypted entries
2026-08-03 16:05:41 -04:00
Maria Solano
1e6d4479d2 fix(lsp): only send didSave to clients attached to the buffer (#41126) 2026-08-03 11:43:33 -07:00
erdivartanovich
0e44ef231a fix(dir): do not swallow errors raised after the list callback
Problem:  An error raised after the list handler ran (e.g. while
          rendering) unwinds through the pcall around provider.list()
          and is routed back into the now no-op handler: silently
          discarded.
Solution: Re-raise the error when the handler has already run.
2026-08-04 01:57:21 +08:00
erdivartanovich
d80121327f fix(dir): keep a listing buffer when the initial listing fails
Problem:  A failed initial directory listing discards the listing state:
          the user is left in an empty modifiable non-listing buffer, and
          the BufEnter autocmd retries the failing open, repeating the
          error on every re-entry.
Solution: Render the failure as an empty listing with state and handlers
          intact: the error is reported once and "R" or :edit retries the
          listing. Keep the error on the listing state so a failed
          listing is distinguishable from an empty one; the next list
          clears it.
2026-08-04 01:57:21 +08:00
Barrett Ruth
1e757a2feb fix(zip): do not warn when zip.lua is disabled 2026-08-03 11:53:20 -05:00
Barrett Ruth
d03b4cfb7a feat(zip): checkhealth and encrypted entries
Problem:
There is no health check. Encrypted entries cannot be read at all, since
Info-ZIP takes a password only from a terminal and `-P` would expose it
in the process arguments.

Solution:
Add `:checkhealth nvim.zip`, reporting the backend and which
implementation is handling archives. Prompt for the password on a pty,
extracting to a file so the entry's bytes stay off the terminal. Report
Info-ZIP's exit code rather than inferring a cause, so an archive using
AES is not reported as a failed decryption.
2026-08-03 11:53:20 -05:00
Freddie Haddad
866d61e91a fix(decor): 'breakindent'/'showbreak' gap ignores active highlight #41073
Problem:
'breakindent' and 'showbreak' draw their own padding with no
reference to whatever decoration or syntax highlight is currently
active, so it goes unhighlighted even mid-highlight, not just past a
real EOL. Gating this on the decoration's `hl_eol` flag (as an
earlier version of this fix did) missed plain highlights with no
`hl_eol` at all, which have the exact same problem.

Solution:
Snapshot decor_attr into decor_attr_save right before it can be
reset by 'linebreak' filler handling, and pass it into
handle_breakindent()/handle_showbreak_and_filler() to extend into
their padding: it is not a real end of the highlight, just screen
cells with no buffer text. Like the 'linebreak' filler, an
underline/strikethrough/overline is excluded, since it looks like a
broken line drawn over the gap. This also fixes 'breakindent' losing
the highlight right after a real 'linebreak' word-push, since that
reset otherwise leaked into the next row.
2026-08-03 11:32:55 -04:00
Christian Clason
a0a04863e4 build(deps): bump luajit to f30aabe82 2026-08-03 16:33:28 +02:00
debaditya
6538d0aadb fix(ui2): retain substitute confirmation highlight with nohlsearch #41067
Problem:
ui2 clears the substitute confirmation match when it updates its prompt buffer with hlsearch disabled.

Solution:
Only invalidate the match highlight when the current buffer changes.
2026-08-03 09:48:33 -04:00
rawan10101
5079787993 docs: mention wasm32-emscripten build target in news.txt 2026-08-03 15:40:16 +03:00
Jan Edmund Lazo
0aed30b4de build(vim-patch): misc n/a funcs, headers, err msgs #41116
* build(vim-patch): n/a func in version.c

init_longVersion() sets datetime for ":version".
Nvim removed it for more deterministic builds.

* build(vim-patch): n/a header from amiga

* build(vim-patch): n/a vim9 err msg for declaring vars

* build(vim-patch): nvim support.txt replaces *os-support*

* build(vim-patch): vim xdg is n/a

* build(vim-patch): n/a 1-line err msg

Vim error message can be 1-line (globals.h), not multi-line (errors.h).
Target v8.2.1032
2026-08-03 05:33:32 -04:00
Freddie Haddad
9ff302d0ca fix(ui): highlight bleeds into 'linebreak' filler #41072
Problem:
When 'linebreak' pushes a word entirely to the next screen row, the
filler cells left on the current row keep whatever highlight was set
by the last real character before the break, even when that highlight
should not extend past it (e.g. an underline, which looks broken drawn
over blank cells).

Solution:
Reset decor_attr and area_attr at the filler when their attribute has
an underline, undercurl, strikethrough, or overline; otherwise leave
them, since a plain background or reverse-video highlight looks
correct extending through blank filler cells, regardless of where the
pushed-down word happens to end. search_attr keeps the same check,
plus its pre-existing on_last_col case (its own match ending exactly
here).
2026-08-03 05:20:04 -04:00
zeertzjq
1f4335fe72 vim-patch:partial:9.2.0899: command output temporary files may collide (#41123)
Problem:  On MS-Windows, get_cmd_output() removes its reserved temporary
          file before the shell opens it, allowing another Vim process to
          reuse the same name.
Solution: Keep the temporary file reserved until command output handling is
          complete (Sam Roeca).

closes: vim/vim#20915

0db0c3c142

Co-authored-by: Sam Roeca <samuel.roeca@gmail.com>
2026-08-03 06:39:00 +08:00
zeertzjq
a5a294c825 vim-patch:9.2.0895: test: Test_aucmd_win_scroll_multibyte() is flaky in the GUI (#41121)
Problem:  The test comparing the top line before and after using the
          autocommand window is flaky in the GUI.
Solution: Run the test in a window with a fixed size.  In the GUI a
          pending resize of the shell is applied at the end of a screen
          update, thus the size may change between the two measurements.

related: vim/vim#20884
closes:  vim/vim#20913

85b8034dff

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 06:38:43 +08:00
rawan10101
17d1ed53ff feat(wasm): implement initial web demo
Introduce an initial browser-based Neovim demo with automatic startup and UI integration. The demo is functional but still requires persistence, additional testing, and further stabilization.

Acknowledgment: UiState in app.js is based on the implementation from github.com/MuNeNiCK/nvim-wasm, with additional modifications and updates
2026-08-02 22:15:30 +03:00
Freddie Haddad
67839a72f7 fix(treesitter): make TSHighlighter.new() idempotent for an active buffer #41090
Problem:
Calling vim.treesitter.start() a second time on a buffer that already
has an active TSHighlighter creates a brand new instance instead of
reusing it, whether the parser tree is unchanged (e.g. calling start()
twice) or different (e.g. switching languages). Either way the old
instance is silently discarded without calling :destroy() on it, so
its on_bytes/on_changedtree/on_detach callbacks stay registered and
its buffer-local state (spelloptions, decoration namespace) is never
restored, both leaking indefinitely for an orphaned instance that
nothing references anymore.

Solution:
Return the existing instance when TSHighlighter.active[source] is
already set for the same parser tree, instead of unconditionally
constructing a new one. When the tree differs instead (e.g. a language
switch), destroy() the old instance first, matching stop() semantics,
before constructing the new one.
2026-08-02 14:42:47 -04:00
Rob Pilling
2f09090134 fix(ui2): :$q should not target hidden windows #40992
Similar to #36123, the ui2 windows confuse `:$q`, which doesn't close
the last window on the tab, but targets a hidden ui2 window.

The problem seems to be a combination of using
`FOR_ALL_WINDOWS_IN_TAB()`, which includes hidden windows, and then
counting the windows without factoring in `win_has_winnr()`.

There are examples of using `win_has_winnr()`, such as:
- [`eval/buffer.c`'s `buf_win_common()`](4a5062cda6/src/nvim/eval/buffer.c (L474-L475))
- [`eval/window.c`'s `f_getwininfo()`](4a5062cda6/src/nvim/eval/window.c (L130-L135))
- [`window.c`'s `win_get_tabwin()`](4a5062cda6/src/nvim/window.c (L7860-L7869))

But possibly problematic ones:
- `ex_docmd.c`'s:
	- [`invalid_range()`](4a5062cda6/src/nvim/ex_docmd.c (L3891-L3893))
		- ^ should this include hidden windows? Can a user address them by number? `win_has_winnr()` suggests not
	- [`ex_close()`](4a5062cda6/src/nvim/ex_docmd.c (L5233-L5244))
	- [`ex_hide()`](4a5062cda6/src/nvim/ex_docmd.c (L5478-L5484))
- `eval/window.c`'s:
	- [`f_winrestcmd()`](4a5062cda6/src/nvim/eval/window.c (L797-L808))
	- [`find_win_by_nr()`](4a5062cda6/src/nvim/eval/window.c (L172-L180))
2026-08-02 14:37:26 -04:00
neil
ecae8c994e ci: check FreeBSD, OpenBSD builds #41091
FreeBSD and OpenBSD are Tier 2 supported platforms (:help
supported-platforms) but have had no CI coverage since Cirrus CI was
dropped in #39321. Restore build coverage for both using vmactions,
which boots the VM on a regular ubuntu-latest runner.
2026-08-02 14:30:23 -04:00
Ro
3b85a689ab docs(api): rpc examples #41077 2026-08-02 08:19:29 -04:00
Justin M. Keyes
f7fbe0e0c8 Merge #41106 from altermo/selection-refactor-fix 2026-08-02 05:33:17 -04:00
github-actions[bot]
7604aa5ef0 docs: update version.c #41092
vim-patch:8.2.0110: prop_find() is not implemented
vim-patch:8.2.0318: Vim9: types not sufficiently tested
vim-patch:8.2.0518: a terminal falls back to setting $TERM to "xterm"
vim-patch:8.2.0543: Vim9: function with varargs does not work properly
vim-patch:8.2.0571: double free when passing invalid argument to job_start()
vim-patch:8.2.0582: color ramp test does not show text colors
vim-patch:8.2.1641: Vim9: cannot use 0 or 1 where a bool is expected
vim-patch:8.2.1692: build fails because TTFLAG_STATIC is missing
vim-patch:8.2.1855: Vim9: get error message when nothing is wrong
vim-patch:8.2.3104: Vim9: unspecified function type causes type error
vim-patch:8.2.3479: crash when calling job_start with an invalid argument
vim-patch:8.2.3481: failures when char is unsigned
vim-patch:9.0.1377: job_status() may return "dead" if the process parent changed
vim-patch:9.0.2084: Vim9: abstract static methods are possible
vim-patch:9.1.0751: Error callback for term_start() not used
vim-patch:9.1.1094: Vim9: problem finding implemented method in type hierarchy
vim-patch:9.2.0889: VMS: spurious "INVALID DECC FEATURE VALUE" message at every startup
vim-patch:6351c1775 CI: Bump github/codeql-action
vim-patch:64b0196a9 runtime(doc): remove todo entry for test_codestyle errors

vim-patch:8.2.0073: initializing globals with COMMA is clumsy
vim-patch:8.2.0253: crash when using :disassamble without argument
vim-patch:8.2.0306: Vim9: :substitute(pat(repl does not work in Vim9 script
vim-patch:8.2.0311: Vim9: insufficient script tests
vim-patch:8.2.0486: Vim9: some code and error messages not tested
vim-patch:8.2.0529: Vim9: function argument with default not checked
vim-patch:8.2.0530: test crashes on s390
vim-patch:8.2.0604: :startinsert in a terminal window used later
vim-patch:8.2.0652: compiler warning for char conversion
2026-08-02 05:30:14 -04:00
Justin M. Keyes
825cb3790e Merge #41103 from janlazo/na-hunk-header 2026-08-02 05:23:38 -04:00
Justin M. Keyes
fe10c5bc36 test(fs): "fs.find() follows symlinks" #41105
Problem:
Test fails if other "build*/" dirs exist with a "nvim" file, e.g.
`build-asan/bin/nvim`.

Solution:
Do the test in an isolated dir.
This also fixes the test for the zig build.
2026-08-02 05:09:58 -04:00
zeertzjq
a5103c0853 vim-patch:9.2.0892: highlight: wrong column highlighted with 'cursorcolumn' (#41110)
Problem:  With 'virtualedit' set to "all" and 'cursorcolumn' set, the wrong
          column may be highlighted after a command that moved the cursor
          into virtual space and back (van-de-bugger).
Solution: Make sure the virtual column is up to date before drawing the
          window (Hirohito Higashi).

fixes:  vim/vim#2576
closes: vim/vim#20902

5a90b9dbd2

Test only. This was already fixed by #39159.

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-02 02:20:11 +00:00
zeertzjq
e9190e9c4f vim-patch:9.2.0894: filetype: ed script files not recognised (#41109)
Problem:  filetype: ed script files not recognised.
Solution: Add filetype detection for *.ed files and shebang lines,
          include syntax script and syntax tests.

Features of the ed syntax file:
- BSD and GNU extensions are supported
- Andrew L. Moore's ed extensions are not supported
- Rebuild synmenu.vim

closes: vim/vim#19602

c28515b999

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-08-02 09:56:10 +08:00
zeertzjq
ad2ae824ec fix(move): using wrong window width (#41108) 2026-08-01 23:18:29 +00:00
Justin M. Keyes
98d767cd53 docs: func/expr options, misc #41102 2026-08-01 17:48:32 -04:00
Jan Edmund Lazo
51da48c8f8 build(vim-patch): libvterm color_ramp.vim is n/a for nvim 2026-08-01 13:22:49 -04:00
Jan Edmund Lazo
92544471e0 build(vim-patch): "build_argv_from_" api is n/a
Meant for Vim job, terminal, cscope, etc.
Incompatible with Nvim implementation.
2026-08-01 13:03:20 -04:00
altermo
8695579636 fix(treesitter): handle &selection=exclusive 2026-08-01 18:21:59 +02:00
altermo
77dfa02f3e refactor: combine all visual_selection funcions 2026-08-01 18:20:13 +02:00
altermo
fe8e6a7efa test(lsp-selection): of by one
The test uses the position col=5,row=5; but such a position
is outside of the buffer.

Presume that it was meant to be col=5,row=4...
2026-08-01 18:15:23 +02:00
Justin M. Keyes
d060d91ef8 fix(bufwrite): coverity "uninitialized member" #41104
CID 652079:           (UNINIT)
    /src/nvim/bufwrite.c: 1413             in buf_write()
    1407         // only makes sense at the start of the file.
    1408         if (buf->b_p_bomb && !write_bin && (!append || perm < 0)) {
    1409           write_info.bw_len = make_bom(buffer, fenc);
    1410           if (write_info.bw_len > 0) {
    1411             // don't convert
    1412             write_info.bw_flags = FIO_NOCONVERT | wb_flags;
    >>>     CID 652079:           (UNINIT)
    >>>     Using uninitialized value "write_info.bw_first" when calling "buf_write_bytes".
    1413             if (buf_write_bytes(&write_info) == FAIL) {
    1414               end = 0;
    1415             } else {
    1416               nchars += write_info.bw_len;
    1417             }
    1418           }
    /src/nvim/bufwrite.c: 1453             in buf_write()
    1447               *s = c;
    1448             }
    1449             s++;
    1450             if (++write_info.bw_len != bufsize) {
    1451               continue;
    1452             }
    >>>     CID 652079:           (UNINIT)
    >>>     Using uninitialized value "write_info.bw_first" when calling "buf_write_bytes".
    1453             if (buf_write_bytes(&write_info) == FAIL) {
    1454               end = 0;                        // write error: break loop
    1455               break;
    1456             }
    1457             nchars += bufsize - write_info.bw_len;
    1458             s = buffer + write_info.bw_len;
2026-08-01 12:15:02 -04:00
Justin M. Keyes
e02755cd9f fix(options): ":set foo?" for Lua callbacks #41100
Problem:
`:set foo=<tab>` and `:set foo?` for func/expr options set to a Lua
function, always displays "v:lua".

The existing "<Lua N: file:line>" form was avoided because the ref id
N changes on every read of the same option.

Solution:
- Don't attempt to tab-complete Lua functions.
- Show "<Lua file:line>" (or "<Lua>" if source file is unknown).

Example:

    :set operatorfunc?
      operatorfunc=<Lua ~/.config/nvim/init.lua:42>
2026-08-01 10:07:26 -04:00
Jan Edmund Lazo
af1b82fc7b build(vim-patch): vim "mch_job_" api is n/a 2026-08-01 09:17:49 -04:00
Jan Edmund Lazo
d95b0fc12c build(vim-patch): n/a vim9 struct from *.h
Target v8.2.0543
This can catch stray '#define' but they're most likely 'TTFLAG' for
Vim9 types. N/A.
TTFLAG is used in 'static_types[]'.
See v9.0.0623.
2026-08-01 09:14:13 -04:00
AlexCodesApps
b11f1b1f76 feat(vim.fs): abspath({cwd, plain}) #40597
Adds optional parameters to `vim.fs.abspath`:
1. `cwd` to specify directory akin to `--relative-from` in `realpath(1)`.
2. `plain` disables expansion of tilde (~) in paths.
2026-08-01 09:09:21 -04:00