Commit Graph

30013 Commits

Author SHA1 Message Date
0c995c0efb vim-patch:9.1.1204: MS-Windows: crash when passing long string to expand() (#32902)
Problem:  MS-Windows: crash when passing long string to expand() with
          'wildignorecase'.
Solution: Use the same buflen as unix_expandpath() in dos_expandpath().
          Remove an unnecessary STRLEN() while at it (zeertzjq).

closes: vim/vim#16896

00a749bd90
(cherry picked from commit ec8fc28743)
2025-03-15 11:21:12 +00:00
aab7129abe vim-patch:9.0.1458: buffer overflow when expanding long file name
Problem:    Buffer overflow when expanding long file name.
Solution:   Use a larger buffer and avoid overflowing it. (Yee Cheng Chin,
            closes vim/vim#12201)

a77670726e

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
(cherry picked from commit b0b61c42b3)
2025-03-15 01:11:50 +00:00
52ad6adc8d vim-patch:8.2.4963: expanding path with "/**" may overrun end of buffer
Problem:    Expanding path with "/**" may overrun end of buffer.
Solution:   Use vim_snprintf().

386c24cd26

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit ad5bced637)
2025-03-15 01:11:50 +00:00
c5eeb1b9ee Merge pull request #32880 from zeertzjq/backport
Backport #32739 to release-0.10
2025-03-14 07:52:06 +08:00
3e7f0a13e1 vim-patch:9.1.1172: [security]: overflow with 'nostartofline' and Ex command in tag file (#32739)
Problem:  heap-buffer-overflow with 'nostartofline' and Ex command in
          tag file.
Solution: Set cursor column when moving cursor to line 1 (zeertzjq).

closes: vim/vim#16796

3ed6659549
2025-03-14 07:32:33 +08:00
2010f398f4 vim-patch:8.2.3579: CI sometimes fails for MinGW
Problem:    CI sometimes fails for MinGW.
Solution:   Use backslashes in HandleSwapExists(). (Christian Brabandt,
            closes vim/vim#9078)

4b2c804767

Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit 24bd7a4a9c)
2025-03-11 01:51:54 +00:00
f0790c565c vim-patch:8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Problem:    Vim9: check for DO_NOT_FREE_CNT is very slow.
Solution:   Move to a separate function so it can be skipped by setting
            $TEST_SKIP_PAT.

dae453f339

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit 1bf9a7ce95)
2025-03-11 01:51:54 +00:00
ecaece926e vim-patch:9.1.1155: Mode message not cleared after :silent message (#32672)
Problem:  Mode message not cleared after :silent message
          (after 9.0.1634).
Solution: Don't reset mode_displayed when the message is empty.
          (zeertzjq)

fixes: neovim/neovim#32641
closes: vim/vim#16744

fce1fa5b61
(cherry picked from commit df0328521f)

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-02-28 00:22:31 +00:00
28a8d59cc7 fix(vim_snprintf): special-case handling of binary format
A binary format spec always expects a corresponding unsigned long long
value. However, that explicit handling didn't get included when porting
the code from Vim, so binary format spec was falling through to the
"unsigned" and "length_modifier = NUL" portion of the code:

        } else {
          // unsigned
          switch (length_modifier) {
          case NUL:
            uarg = (tvs
                    ? (unsigned)tv_nr(tvs, &arg_idx)
                    : (skip_to_arg(ap_types, ap_start, &ap, &arg_idx,
                                   &arg_cur, fmt),
                       va_arg(ap, unsigned)));
            break;

This incorrectly read an "unsigned" value from an "unsigned long long"
variable, which would produce incorrect results on certain platforms.

(cherry picked from commit 453f2c52d2)
2025-02-26 11:53:08 +00:00
3c57ee079d test(unit/strings_spec): show ctx when vim_snprintf content check fails #32570
Same idea as a7be4b7bf8, but that only showed the context if the
length of the string differed. Since these tests check both string
length and string content, the ctx should be provided for both.

    ERROR    test/unit/testutil.lua @ 797: vim_snprintf() positional arguments
    test/unit/testutil.lua:769: test/unit/testutil.lua:753: (string) '
    test/unit/strings_spec.lua:159: snprintf(buf, 4, "%1$0.*2$b", 12ULL, cdata<int>: 0xf78c8ed8) = 001100
    Expected objects to be the same.
    Passed in:
    (string) '000'
    Expected:
    (string) '001''

(cherry picked from commit 1c81734871)
2025-02-23 01:39:41 +00:00
e6432b0094 fix(tests): filter out lines with __typeof__ keyword (#32524)
Problem: On 32-bit architectures, musl libc makes heavy use of
__typeof__ as part of its __REDIR macro for optional backwards
compatibility with 32-bit time_t values. Unfortunately, the
__typeof__ keyword is not supported by the LuaJIT C parser.

Solution: Filter out the keyword in filter_complex_blocks.
(cherry picked from commit db2c3d1143)
2025-02-22 00:09:59 +00:00
00d3956109 fix(treesitter): don't spam query errors in the highlighter
**Problem:** An erroneous query in the treesitter highlighter gives a
deluge of errors that makes the editor almost unusable.

**Solution:** Detach the highlighter after an error is detected, so that
it only gets displayed once (per highlighter instance).

(cherry picked from commit b0bbe25c48)
2025-02-20 01:32:10 +00:00
d65ce60f49 Merge pull request #32501 from zeertzjq/backport
Backport #32483 to release-0.10
2025-02-18 07:14:58 +08:00
0f0959ca32 fix(tests): remove the __extension__ keyword in filter_complex_blocks (#32483)
Problem: This keyword is used by GCC and Clang to prevent -Wpedantic
(and other options) from emitting warnings for many GNU C extensions.
This is used heavily in Alpine Linux through musl libc and
foritfy-headers. Without filtering the __extension__ keyword some type
definitions are duplicated. For example, timeval is defined once as

  struct timeval { time_t tv_sec; suseconds_t tv_usec; };

and once as:

  __extension__ struct timeval { time_t tv_sec; suseconds_t tv_usec; };

Without this patch, the LuaJIT C parser doesn't recognize that these
definitions are equivalent, causing unit test to fail on Alpine Linux.

Solution: Filter out the keyword in filter_complex_blocks.
2025-02-18 06:48:28 +08:00
6b6abb8969 vim-patch:9.1.1108: 'smoothscroll' gets stuck with 'listchars' "eol" (#32434)
Problem:  'smoothscroll' gets stuck with 'listchars' "eol".
Solution: Count size of 'listchars' "eol" in line size when scrolling.
          (zeertzjq)

related: neovim/neovim#32405
closes: vim/vim#16627

2c47ab8fcd
(cherry picked from commit 9f85dace94)
2025-02-13 23:48:31 +00:00
6ca2ef8dfe ci(cirrus): update to freebsd-14-2
Previous `freebsd-14-0` image was dropped

(cherry picked from commit 8117db48ed)
2025-02-12 17:12:05 +00:00
3fd08c2eb2 fix(memline): don't check line count for closed memline #32403
Problem:  Error thrown when for invalid line number which may be accessed
          in an `on_detach` callback at which point line count is
          intentionally set to 0.
Solution: Move empty memline check to before line number check.
(cherry picked from commit 15bc930fca)
2025-02-12 16:49:02 +00:00
7e5b7ae4e0 fix(lsp): prevent desync due to empty buffer (#29904)
Problem:
Some language servers (e.g., rust-analyzer, texlab) are desynced when
the user deletes the entire contents of the buffer. This is due to the
discrepancy between how nvim computes diff and how nvim treats empty
buffer.
* diff: If the buffer became empty, then the diff includes the last
  line's eol.
* empty buffer: Even if the buffer is empty, nvim regards it as having
  a single empty line with eol.

Solution:
Add special case for diff computation when the buffer becomes empty so
that it does not include the eol of the last line.
2025-02-08 10:48:31 +01:00
c40057f372 fix(lsp): check for valid buf before processing semantic tokens response
Problem: There is no check for buffer validity before processing
  semantic tokens response. This can lead to `Invalid buffer id` error
  if processing request takes a long time and the buffer is wiped out.

  For example, this can happen after by accident navigating to a buffer
  from different project which leads to first loading project's
  workspace and *then* processing semantic tokens. During that time
  a buffer can be wiped out, as navigation to it was by accident.

Solution: Add extra check for buffer validity before processing semantic
  tokens response.
(cherry picked from commit a9cdf76e3a)
2025-02-08 01:24:58 +00:00
c7bb6bbdea vim-patch:9.1.1077: included syntax items do not understand contains=TOP (#32343)
Problem:  Syntax engine interpreted contains=TOP as matching nothing
          inside included files, since :syn-include forces HL_CONTAINED
          on for every included item. After 8.2.2761, interprets
          contains=TOP as contains=@INCLUDED, which is also not correct
          since it doesn't respect exclusions, and doesn't work if there
          is no @INCLUDED cluster.
Solution: revert patch 8.2.2761, instead track groups that have had
          HL_CONTAINED forced, and interpret contains=TOP and
          contains=CONTAINED using this. (Theodore Dubois)

fixes: vim/vim#11277
closes: vim/vim#16571

f50d5364d7

Co-authored-by: Theodore Dubois <tblodt@icloud.com>
(cherry picked from commit 878b3b89c3)
2025-02-06 00:33:50 +00:00
c3866cea60 feat(win32): embed executable icon
Problem: on windows, the neovim executable (and thus the filetypes
associated to open with neovim) has no embedded icon

Solution: create a windows resource file pointing to the icon, and
add it to the nvim binary target

(cherry picked from commit cb84cd5d9f)
2025-02-05 20:54:05 +00:00
d6da862ce0 test(unit/strings_spec): use correct type for binary values
When 9.0.1856 was ported, the numbers being formatted as binary were cast
to "unsigned int" rather than uvarnumber_T, as is done upstream.

(cherry picked from commit 1426f3f3ce)
2025-01-29 20:25:38 +00:00
452ed57b71 test(unit/strings_spec): provide context for vim_snprintf tests
Since these assertions all use a common function to perform the test
assertions, it's difficult to figure out which test failed:

    ERROR    test/unit/testutil.lua @ 785: vim_snprintf() positional arguments
    test/unit/testutil.lua:757: test/unit/testutil.lua:741: (string) '
    test/unit/strings_spec.lua:143: Expected objects to be the same.
    Passed in:
    (number) 6400
    Expected:
    (number) 6'
    exit code: 256

Adding context to the assertion makes it clearer what the problem is:

    ERROR    test/unit/testutil.lua @ 785: vim_snprintf() positional arguments
    test/unit/testutil.lua:757: test/unit/testutil.lua:741: (string) '
    test/unit/strings_spec.lua:149: snprintf(buf, 0, "%1$0.*2$b", cdata<unsigned int>: 0xf78d0f38, cdata<int>: 0xf78dc4e0) = 001100
    Expected objects to be the same.
    Passed in:
    (number) 6400
    Expected:
    (number) 6'
    exit code: 256

(cherry picked from commit a7be4b7bf8)
2025-01-29 20:25:38 +00:00
44c6fbaf9a version bump 2025-01-29 11:20:06 +01:00
e96f75a4e6 NVIM 0.10.4
This is maintenance release, focusing on bug fixes. It also contains changes
to the available binary releases.

A Linux AArch64 binary has been added as part of the binary releases.
In addition, the previous "linux64" binary has been renamed to "linux-x86_64".
This is a BREAKING changes for scripts which consumes our binary releases.

FIXES
--------------------------------------------------------------------------------
- a8eddf1eb1 checkhealth: failed if 'lua' in plugin name
- 2bc5e1be0f decor: set invalid flag for end of invalidated paired marks
- d8149e5af9 inspect: use correct default highlight
- 357ee88606 jobs: do not block UI when jobwait() doesn't block (#31803)
- b0b383bff9 lsp: minimum height for floating popup #31990
- 4b25fe09cc lua: prevent SIGSEGV when lua error is NULL in libuv_worker (#32091)
- e477ac7c45 marks: revise metadata for start mark of revalidated pair #32017
- 22a327a20e mpack: remove invalid bool definition
- 87440e7bc5 runtime: let matchit and matchparen skips fallback on treesitter captures
- f132efaefb search: avoid quadratic time complexity when computing fuzzy score (#32153)
- ca10442e01 treesitter: don't open fold when o/O adds a line below #28709
- 323c43e1c4 treesitter: uv_dlclose after uv_dlerror
- a3cc513b67 treesitter.foldexpr: only refresh valid buffers
- a986048cb0 treesitter.foldexpr: refresh in the buffers affected by OptionSet
- d7ee06124d treesitter.foldexpr: robustness against ctrl-c
- 79030bf196 ui: ensure screen update before waiting for input #30576
- 3a50639331 9.1.0699: "dvgo" is not always an inclusive motion (#30173)
- 6a6c6b2658 9.1.0708: Recursive window update does not account for reset skipcol (#30217)
- 938a600847 9.1.1048: crash after scrolling and pasting in silent Ex mode (#32168)

BUILD
--------------------------------------------------------------------------------
- fdcdf560da release: add linux-arm64 appimage and tarball
- a7392c04d9 tests: add arm64 runner
v0.10.4
2025-01-29 11:10:58 +01:00
8d420a32db ci(release)!: remove backwards compatible releases
Remove `nvim-linux64.tar.gz` and `nvim.appimage` as maintaining
these is too much work.

Also fix directory names to be consistent.

(cherry picked from commit 318676ad13)
2025-01-28 11:12:21 +01:00
fdcdf560da ci(release): add linux-arm64 appimage and tarball
Problem: No releases for ARM Linux.

Solution: Provide appimages and tarballs for `linux-arm64`. Rename
x86 releases to `linux-x86_64` for consistency.

(cherry picked from commit c1718d6863)
2025-01-28 11:12:21 +01:00
22a327a20e fix(mpack): remove invalid bool definition
This causes build failures with gcc 15.

Fixes #31723

(cherry picked from commit 83479b95ab)
2025-01-28 03:33:12 +00:00
d63848c918 Merge pull request #32197 from zeertzjq/backport
ci(tests): add arm64 runner
2025-01-28 11:16:55 +08:00
a6c54fdfc1 ci(tests): remove build-types jobs
Problem: Some CI jobs are redundant: `RelWithDebInfo` is already tested
on Linux-Arm64; `MinSizeRel` and Ninja Multi Config are not sufficiently
relevant in practice to spend CI cycles on.

Solution: Remove `build-types` job.
(cherry picked from commit 0fd4ef5da7)
2025-01-25 08:28:06 +08:00
a7392c04d9 ci(tests): add arm64 runner
Problem: Linux `aarch64`/`arm64` builds are not tested.

Solution: Add `ubuntu-arm` runners to test matrix (using
`RelWithDebInfo` build).

(cherry picked from commit 3702bcb139)
2025-01-25 08:27:55 +08:00
7908900859 docs(support): update tested macOS and FreeBSD versions (#32191) 2025-01-24 10:07:05 +00:00
a8eddf1eb1 fix(checkhealth): failed if 'lua' in plugin name
(cherry picked from commit 4c9f3689a1)
2025-01-23 08:25:31 +00:00
938a600847 vim-patch:9.1.1048: crash after scrolling and pasting in silent Ex mode (#32168)
Problem:  Crash after scrolling and pasting in silent Ex mode.
          (fizz-is-on-the-way)
Solution: Don't move cursor to line 0 when scrolling.
          (zeertzjq)

closes: vim/vim#16506

df098fedbc
(cherry picked from commit a9c12d4c29)
2025-01-23 00:36:43 +00:00
3a50639331 vim-patch:9.1.0699: "dvgo" is not always an inclusive motion (#30173)
Problem:  "dvgo" is not always an inclusive motion
          (Iain King-Speir)
Solution: initialize the inclusive flag to false

fixes: vim/vim#15580
closes: vim/vim#15582

f8702aeb8f

Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit 0346666f71)
2025-01-22 07:17:20 +00:00
f132efaefb fix(search): avoid quadratic time complexity when computing fuzzy score (#32153)
(cherry picked from commit a8b6fa07c4)
2025-01-22 01:54:04 +00:00
46cc8a52b2 Merge pull request #32102 from tomtomjhj/cherrypick-ts-foldexpr
Backport treesitter foldexpr fixes
2025-01-19 11:31:47 -08:00
a3cc513b67 fix(treesitter.foldexpr): only refresh valid buffers
Problem: autocmd to refresh folds always uses the current buffer if the
option type is local. However, the current buffer may not have a parser,
and thus the assert that checks for a parser could fail.

Solution: check if the foldinfo contains the buffer, and only refresh if
so.
2025-01-20 00:27:42 +09:00
a986048cb0 fix(treesitter.foldexpr): refresh in the buffers affected by OptionSet 2025-01-20 00:27:39 +09:00
d7ee06124d fix(treesitter.foldexpr): robustness against ctrl-c
Problem:
Exiting the insert mode with ctrl-c does not trigger InsertLeave
autocmd. This may lead to nil error in treesitter foldexpr.

Solution:
Check nil. Folds still can be stale after exiting the insert mode with
ctrl-c, but it will be eventually updated correctly.

An alternative solution would be to ensure that exiting the insert mode
always triggers do_foldupdate. This can be done either by "fixing"
ctrl-c or with on_key callback that checks ctrl-c (nvim-cmp does this).
2025-01-20 00:26:52 +09:00
ca10442e01 fix(treesitter): don't open fold when o/O adds a line below #28709
Problem:
`o`-ing on a folded line opens the fold, because the new line gets the
fold level from the above line (level '='), which extends the fold to
the new line. `O` has a similar problem when run on the line below a
fold.

Solution:
Use -1 for the added line to get the lower level from the above/below
line.
2025-01-20 00:26:03 +09:00
4b25fe09cc fix(lua): prevent SIGSEGV when lua error is NULL in libuv_worker (#32091)
Problem:
Calling `xstrdup` with a NULL pointer causes a SIGSEGV if `lua_tostring` returns
NULL in `nlua_luv_thread_common_cfpcall`.

Crash stack trace:
- `_platform_strlen` → `xstrdup` (memory.c:469)
- `nlua_luv_thread_common_cfpcall` (executor.c:281)

Solution:
Check if `lua_tostring` returns NULL and pass NULL to `event_create` to avoid the crash.

(cherry picked from commit a5b1b83a26)

Co-authored-by: 林玮 (Jade Lin) <linw1995@icloud.com>
2025-01-19 01:00:18 +00:00
baaaf6a9e7 build: fix install 2025-01-15 21:27:02 +01:00
e477ac7c45 fix(marks): revise metadata for start mark of revalidated pair #32017
Problem:  Metadata may be revised for end mark of a revalidated pair.
Solution: Revise metadata for start mark of a revalidated pair.
(cherry picked from commit 5cc93ef472)
2025-01-15 10:56:52 +00:00
3b5c2213fd build: fix make install on cmake 3.13 and 3.14
Closes https://github.com/neovim/neovim/issues/30756.
2025-01-15 09:33:30 +01:00
5aabe5695f Update test/functional/plugin/lsp_spec.lua 2025-01-14 12:36:42 +00:00
b0b383bff9 fix(lsp): minimum height for floating popup #31990
Problem:
The floating window for hover and signature help always cuts off a few lines,
because the `_make_floating_popup_size` function counts empty lines as having
zero height.

Solution:
Ensure the height is at least 1.

(cherry picked from commit a4f575abd8)
2025-01-14 12:36:42 +00:00
323c43e1c4 fix(treesitter): uv_dlclose after uv_dlerror
(cherry picked from commit 5a54681025)
2025-01-14 09:48:10 +00:00
2bc5e1be0f fix(decor): set invalid flag for end of invalidated paired marks
(cherry picked from commit 87610d82db)
2025-01-10 07:41:32 +00:00
87440e7bc5 fix(runtime): let matchit and matchparen skips fallback on treesitter captures
When treesitter is enabled, by default syntax groups are not defined, but these
groups are used to identify where to skip matches in matchit and matchparen.

This patch does three things:
1. If syntax is enabled regardless of treesitter (`vim.bo.syntax='on'`):
   Use original implementation.
2. If treesitter is enabled and syntax is not:
   Match the syntax groups (i.e. `comment\|string`) against treesitter captures
   to check for skipped groups.
3. Add an explicit treesitter syntax for marking captures to skip:
   matchit uses `b:match_skip` to determine what counts as skippable
   Where 's:comment\|string' uses a match of the named syntax groups against
   a regex match of comment\|string, 't:comment\|string' now uses vim regex
   to match against the names of the treesitter capture groups.

(cherry picked from commit 69aa33d890)
2025-01-04 19:48:25 +00:00