Commit Graph

31773 Commits

Author SHA1 Message Date
Justin M. Keyes
ad853d1df0
fix(messages): improve deadly signal messages #32364
Problem:
Deadly signal messages mention "Vim", and add redundant newlines.

Solution:
- Update the messages.
- Don't add an extra newline.
2025-02-07 05:49:52 -08:00
zeertzjq
52ff5e3032
vim-patch:b69cd52: runtime(misc): Add support for lz4 to tar & gzip plugin (#32360)
while at it, clean up the tar plugin a bit and sort the patterns for the
tar and gzip plugin

References:
- https://github.com/lz4/lz4
- https://lz4.org/

closes: vim/vim#16591

b69cd52447

Co-authored-by: Corpulent Robin <177767857+corpulentrobin@users.noreply.github.com>
2025-02-07 17:10:51 +08:00
zeertzjq
5371659524
Merge pull request #32358 from zeertzjq/vim-8.2.0849
vim-patch:8.2.{0849,0931},9.1.1081
2025-02-07 07:05:44 +08:00
zeertzjq
7c43f1128d vim-patch:9.1.1081: has('bsd') is true for GNU/Hurd
Problem:  has('bsd') is true for GNU/Hurd
Solution: exclude GNU/Hurd from BSD feature flag
          (Zhaoming Luo)

GNU/Hurd, like Mac OS X, is a BSD-based system. It should exclude
has('bsd') feature just like what Mac OS X does. The __GNU__ pre-defined
macro indicates it's compiled for GNU/Hurd.

closes: vim/vim#16580

a41dfcd55b

Co-authored-by: Zhaoming Luo <zhmingluo@163.com>
2025-02-07 06:30:11 +08:00
zeertzjq
d8e191a6ab vim-patch:8.2.0849: BeOS code is not maintained and probably unused
Problem:    BeOS code is not maintained and probably unused.
Solution:   Remove the BeOS code. (Emir Sari, closes vim/vim#5817)

041c7107f2

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-02-07 06:30:11 +08:00
zeertzjq
893fad2851 test(old): reorder test_functions.vim to match upstream 2025-02-07 06:30:10 +08:00
Christian Clason
5f54f03285 vim-patch:9.1.1080: filetype: Mill files are not recognized
Problem:  filetype: Mill files are not recognized
Solution: detect '*.mill' files as scala filetype
          (author)

In the past [Mill](https://mill-build.org/mill/index.html) build files
were always `build.sc` and treated as Scala files. However as the 0.12.x
series of mill you can create a `build.mill` file. You can see a lot of
examples of this if you search
[GitHub](https://github.com/search?q=build.mill&type=code). This small
change just ensures that if you have a `*.mill` file it treats it as a
Scala file.

closes: vim/vim#16585

9c8f9b10fc

Co-authored-by: Chris Kipp <ckipp@pm.me>
2025-02-06 23:23:58 +01:00
Siddhant Agarwal
6db830e40e
feat(defaults): enable diffopt "linematch" #32346 2025-02-06 04:17:36 -08:00
zeertzjq
878b3b89c3
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>
2025-02-06 08:04:42 +08:00
Justin M. Keyes
44740e561f
fix(log): RPC log format #32337
Problem:
RPC log messages show `log_notify` function name, which is not useful:

    DBG 2025-02-04T22:28:02.419 ui.37862   log_notify:57: RPC -> 3: [notify]    nvim_ui_set_focus
    DBG 2025-02-04T22:28:02.419 nvim.37863.0 log_notify:57: RPC <- 1: [notify]    nvim_ui_set_focus

Solution:
Call logmsg() directly.

    DBG 2025-02-04T22:42:00.104 ui.40680   RPC: -> 3: [notify]    nvim_ui_attach
    DBG 2025-02-04T22:42:00.104 ui.40680   RPC: -> 3: [notify]    nvim_set_client_info
2025-02-05 13:23:33 -08:00
Maria José Solano
38a52caec0 feat(diagnostic): add current_line option for virtual_text handler 2025-02-05 15:27:09 +01:00
Riley Bruins
09f9f0a946 feat(treesitter): show which nodes are missing in InspectTree
Now `:InspectTree` will show missing nodes as e.g. `(MISSING identifier)`
or `(MISSING ";")` rather than just `(identifier)` or `";"`. This is
doable because the `MISSING` keyword is now valid query syntax.

Co-authored-by: Christian Clason <c.clason@uni-graz.at>
2025-02-05 09:29:31 +01:00
Christian Clason
d769c340b9 build(deps): bump luv to v1.50.0-1 2025-02-05 09:29:14 +01:00
zeertzjq
aa976f0d93
fix(messages): add a trailing space to inputlist() etc. prompts (#32328)
Before #31525 the prompts had a trailing space.
Also add a test for #7857.
2025-02-05 11:36:01 +08:00
zeertzjq
1deb580977
vim-patch:9.1.1076: vim_strnchr() is strange and unnecessary (#32327)
Problem:  vim_strnchr() is strange and unnecessary (after v9.1.1009)
Solution: Remove vim_strnchr() and use memchr() instead.  Also remove a
          comment referencing an #if that is no longer present.

vim_strnchr() is strange in several ways:
- It's named like vim_strchr(), but unlike vim_strchr() it doesn't
  support finding a multibyte char.
- Its logic is similar to vim_strbyte(), but unlike vim_strbyte() it
  uses char instead of char_u.
- It takes a pointer as its size argument, which isn't convenient for
  all its callers.
- It allows embedded NULs, unlike other "strn*" functions which stop
  when encountering a NUL byte.

In comparison, memchr() also allows embedded NULs, and it converts bytes
in the string to (unsigned char).

closes: vim/vim#16579

34e1e8de91
2025-02-05 07:06:33 +08:00
zeertzjq
4317d36669
fix(event-loop): process input before events in getchar() (#32322)
Follow-up to #27358.
2025-02-05 06:48:56 +08:00
dundargoc
e4a58a7ca0 ci(vim-patches): fix failing workflow 2025-02-04 10:48:10 +01:00
Riley Bruins
1103d9fc10
build(deps): bump tree-sitter-query to v0.5.0 (#32299)
and sync queries from nvim-treesitter (adds support for `MISSING` nodes).
2025-02-04 09:56:11 +01:00
zeertzjq
8ce2833411
test(terminal/cursor_spec): remove unnecessary busy handlers (#32321)
They are no longer necessary after #31562, as busy_start and busy_stop
are no longer emitted by terminal buffers with visible cursor.
2025-02-04 10:07:35 +08:00
zeertzjq
3d22293496
test(getchar_spec): fix flakiness (#32320)
Problem:  getchar_spec may fail when screen:expect_unchanged() doesn't
          wait long enough.
Solution: Add poke_eventloop() before screen:expect_unchanged().
2025-02-04 01:31:37 +00:00
zeertzjq
40edfb0af0
Merge pull request #32315 from zeertzjq/vim-9.1.1009
vim-patch:9.1.{1009,1022,1023,1027,1072}
2025-02-04 09:13:51 +08:00
zeertzjq
3a1fe4732d vim-patch:9.1.1072: 'diffopt' "linematch" cannot be used with {n} less than 10
Problem:  'diffopt' "linematch" cannot be used with {n} less than 10
          digits (after v9.1.1022)
Solution: Fix off-by-one error when checking for digit (zeertzjq)

closes: vim/vim#16577

ccd7f454fc
2025-02-04 08:42:53 +08:00
zeertzjq
bd145a6c83 vim-patch:9.1.1027: no sanitize check when running linematch
Problem:  no sanitize check when running linematch
Solution: add sanitize check before applying the linematch algorithm,
          similar to diff_find_change() (Jonathon)

closes: vim/vim#16446

ca307efe48

Co-authored-by: Jonathon <jonathonwhite@protonmail.com>
2025-02-04 08:42:53 +08:00
zeertzjq
4d0c6cae72 vim-patch:9.1.1023: Coverity complains about dereferencing NULL pointer
Problem:  Coverity complains about dereferencing NULL pointer
Solution: Verify curdiff is not null before dereferencing it

closes: vim/vim#16437

a9f77be922

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-02-04 08:42:53 +08:00
zeertzjq
1c3bda7e92 vim-patch:9.1.1022: linematch option value not completed
Problem:  linematch option value not completed
          (after v9.1.1009)
Solution: Update diffoption completion values

related: vim/vim#9661
closes: vim/vim#16437

9162e636b3

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-02-04 08:42:53 +08:00
zeertzjq
290bb4c64b vim-patch:9.1.1009: diff feature can be improved
Problem:  diff feature can be improved
Solution: include the linematch diff alignment algorithm
          (Jonathon)

closes: vim/vim#9661

7c7a4e6d1a

Co-authored-by: Jonathon <jonathonwhite@protonmail.com>
2025-02-04 08:42:53 +08:00
zeertzjq
5a7cf85c2c
vim-patch:9.1.1074: Strange error when heredoc marker starts with "trim" (#32317)
Problem:  Strange error when heredoc marker starts with "trim".
Solution: Check for whitespace after "trim" or "eval" (zeertzjq)

For :python3 etc., a heredoc marker that starts with a lower-case letter
is valid, and when it starts with "trim" it works in a script but not in
a function, and this PR makes it works in a function.
For :let, a heredoc marker that starts with a lower-case letter is not
valid, but when it starts with "trim" or "eval" the error can be a bit
confusing in a function, and this PR make it less confusing.

closes: vim/vim#16574

449c2e5454
2025-02-04 07:44:41 +08:00
zeertzjq
f618cdf9c4
Merge pull request #31604 from zeertzjq/vim-9.1.0935
vim-patch:9.1.{0935,0967,1073}
2025-02-04 07:44:15 +08:00
zeertzjq
ca8694a69d vim-patch:9.1.1073: tests: test_compiler fails on Windows without Maven
Problem:  tests: test_compiler fails on Windows without Maven.
Solution: Add Xspotbugs directory to $PATH when mvn is not available
          (zeertzjq).

closes: vim/vim#16576

23da16d3d0
2025-02-04 06:45:31 +08:00
zeertzjq
89c2945148 vim-patch:9.1.0967: SpotBugs compiler setup can be further improved
Problem:  SpotBugs compiler can be further improved
Solution: Introduce event-driven primitives for SpotBugs
          (Aliaksei Budavei)

closes: vim/vim#16258

2e252474c4

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-02-04 06:45:25 +08:00
zeertzjq
d7426bc9e9 vim-patch:9.1.0935: SpotBugs compiler can be improved
Problem:  SpotBugs compiler can be improved
Solution: runtime(compiler): Improve defaults and error handling for
          SpotBugs; update test_compiler.vim (Aliaksei Budavei)

runtime(compiler): Improve defaults and error handling for SpotBugs

* Keep "spotbugs#DefaultPreCompilerTestAction()" defined but
  do not assign its Funcref to the "PreCompilerTestAction"
  key of "g:spotbugs_properties": there are no default and
  there can only be introduced arbitrary "*sourceDirPath"
  entries; therefore, this assignment is confusing at best,
  given that the function's implementation delegates to
  whatever "PreCompilerAction" is.

* Allow for the possibility of relative source pathnames
  passed as arguments to Vim for the Javac default actions,
  and the necessity to have them properly reconciled when
  the current working directory is changed.

* Do not expect users to remember or know that new source
  files ‘must be’ ":argadd"'d to be then known to the Javac
  default actions; so collect the names of Java-file buffers
  and Java-file Vim arguments; and let users providing the
  "@sources" file-lists in the "g:javac_makeprg_params"
  variable update these file-lists themselves.

* Strive to not leave behind a fire-once Syntax ":autocmd"
  for a Java buffer whenever an arbitrary pre-compile action
  errors out.

* Only attempt to run a post-compiler action in the absence
  of failures for a pre-compiler action.  Note that warnings
  and failures are treated alike (?!) by the Javac compiler,
  so when previews are tried out with "--enable-preview",
  remember about passing "-Xlint:-preview" too to also let
  SpotBugs have a go.

* Properly group conditional operators when testing for key
  entries in a user-defined variable.

* Also test whether "javaExternal" is defined when choosing
  an implementation for source-file parsing.

* Two commands are provided to toggle actions for buffer-local
  autocommands:
  - SpotBugsRemoveBufferAutocmd;
  - SpotBugsDefineBufferAutocmd.

For example, try this from "~/.vim/after/ftplugin/java.vim":
------------------------------------------------------------
if exists(':SpotBugsDefineBufferAutocmd') == 2
	SpotBugsDefineBufferAutocmd BufWritePost SigUSR1
endif
------------------------------------------------------------

And ":doautocmd java_spotbugs User" can be manually used at will.

closes: vim/vim#16140

368ef5a48c

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-02-04 06:45:25 +08:00
Justin M. Keyes
eacd662ccb
Merge #32082 refactor(treesitter): use coroutines for resuming _parse() 2025-02-03 09:11:04 -08:00
uio23
720ec5cec2
fix(tui): cursor color in suckless terminal #32310
Problem:
's 'guicursor' cursor color not working in suckless terminal (ST).
Nvim's builtin terminfo for ST lacks a "Cs" entry, even though ST does
support the cursor color to be set via termcodes.

Solution:
- In `augment_terminfo()`, assume that `st` always supports color cursor.
- Thomas Dickey will add a "Cs" entry for st to ncurses, from which
  Nvim's builtin terminfos are generated.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-02-03 01:09:47 -08:00
Maria José Solano
445ecca398
feat(diagnostic): format() can filter diagnostics by returning nil #32302 2025-02-03 00:54:31 -08:00
zeertzjq
3a28930157
vim-patch:9.0.1391: "clear" macros are not always used (#32312)
Problem:    "clear" macros are not always used.
Solution:   Use ALLOC_ONE, VIM_CLEAR, CLEAR_POINTER and CLEAR_FIELD in more
            places. (Yegappan Lakshmanan, closes vim/vim#12104)

960dcbd098

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-02-03 05:20:48 +00:00
zeertzjq
0c8890e7a7
vim-patch:8.2.4948: cannot use Perl heredoc in nested :def function (#32311)
Problem:    Cannot use Perl heredoc in nested :def function. (Virginia
            Senioria)
Solution:   Only concatenate heredoc lines when not in a nested function.
            (closes vim/vim#10415)

d881d15984

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-02-03 12:49:33 +08:00
zeertzjq
efa3677f28
Merge pull request #32293 from zeertzjq/vim-9.1.1063
vim-patch:8.2.{0825,1445,2505},9.0.1142,9.1.{1063,1066,1071}
2025-02-03 12:07:22 +08:00
zeertzjq
db7db783a2 vim-patch:9.1.1071: args missing after failing to redefine a function
Problem:  Arguments of a function are missing after failing to redefine
          it (after 8.2.2505), and heap-use-after-free with script-local
          function (after 9.1.1063).
Solution: Don't clear arguments or free uf_name_exp when failing to
          redefine an existing function (zeertzjq)

closes: vim/vim#16567

04d2a3fdc0
2025-02-03 11:27:56 +08:00
zeertzjq
82ac8294c2 vim-patch:9.1.1066: heap-use-after-free and stack-use-after-scope with :14verbose
Problem:  heap-use-after-free and stack-use-after-scope with :14verbose
          when using :return and :try (after 9.1.1063).
Solution: Move back the vim_free(tofree) and the scope of numbuf[].
          (zeertzjq)

closes: vim/vim#16563

2101230f40
2025-02-03 11:27:56 +08:00
zeertzjq
b853ef770a vim-patch:9.1.1063: too many strlen() calls in userfunc.c
Problem:  too many strlen() calls in userfunc.c
Solution: refactor userfunc.c and remove calls to strlen(),
          drop set_ufunc_name() and roll it into alloc_ufunc(),
          check for out-of-memory condition in trans_function_name_ext()
          (John Marriott)

closes: vim/vim#16537

b32800f7c5

Add missing change to call_user_func() from patch 8.1.1007.
Consistently use PRIdSCID instead of PRId64 for script IDs.

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-02-03 11:27:56 +08:00
zeertzjq
82b029cbb0 vim-patch:9.0.1142: crash and/or memory leak when redefining function
Problem:    Crash and/or memory leak when redefining function after error.
Solution:   Clear pointer after making a copy.  Clear arrays on failure.
            (closes vim/vim#11774)

f057171d8b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-02-03 11:14:17 +08:00
zeertzjq
638c6b406b vim-patch:8.2.2505: Vim9: crash after defining function with invalid return type
Problem:    Vim9: crash after defining function with invalid return type.
Solution:   Clear function growarrays.  Fix memory leak.

31842cd077

Cherry-pick free_fp from patch 8.2.3812.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-02-03 11:14:17 +08:00
zeertzjq
cd42740245 vim-patch:8.2.1445: Vim9: function expanded name is cleared when sourcing again
Problem:    Vim9: function expanded name is cleared when sourcing a script
            again.
Solution:   Only clear the expanded name when deleting the function.
            (closes vim/vim#6707)

c4ce36d486

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-02-03 11:14:17 +08:00
zeertzjq
0309d3fbf0 vim-patch:8.2.0825: def_function() may return pointer that was freed
Problem:    def_function() may return pointer that was freed.
Solution:   Set "fp" to NULL after freeing it.

a14e697547

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-02-03 11:14:13 +08:00
zeertzjq
af069c5c05
vim-patch:9.1.1070: Cannot control cursor positioning of getchar() (#32303)
Problem:  Cannot control cursor positioning of getchar().
Solution: Add "cursor" flag to {opts}, with possible values "hide",
          "keep" and "msg".

related: vim/vim#10603
closes: vim/vim#16569

edf0f7db28
2025-02-03 00:09:03 +00:00
luukvbaal
87e806186c
fix(statusline): overwriting stl_items with nvim_eval_statusline() {-item #32265
Problem:
When an evaluation {-item calls `nvim_eval_statusline()`, that nested
call may overwrite the same memory used for `stl_items`.

Solution:
Make `curitem` static and use it to compute an offset to avoid
overwriting `stl_items` in nested calls to `build_stl_str_hl()`. Move
miscellaneous statusline tests into `describe()` block.
2025-02-02 15:09:43 -08:00
Riley Bruins
8543aa406c feat(treesitter): allow LanguageTree:is_valid() to accept a range
When given, only that range will be checked for validity rather than the
entire tree. This is used in the highlighter to save CPU cycles since we
only need to parse a certain region at a time anyway.
2025-02-02 12:13:25 -08:00
Riley Bruins
9508d6a814 refactor(treesitter): use coroutines for resuming _parse() logic
This means that all work previously done by a `_parse()` iteration will
be kept in future iterations. This prevents it from running indefinitely
in some cases where the file is very large and there are 2+ injections.
2025-02-02 11:51:24 -08:00
Riley Bruins
77be44563a
refactor(treesitter): always return valid range from parse() #32273
Problem:
When running an initial parse, parse() returns an empty table rather
than an actual range. In `languagetree.lua`, we manually check if
a parse was incremental to determine the changed parse region.

Solution:
- Always return a range (in the C side) from parse().
- Simplify the language tree code a bit.
- Logger no longer shows empty ranges on the initial parse.
2025-02-02 03:46:26 -08:00
Riley Bruins
02ea0e77a1
refactor(treesitter): drop LanguageTree._has_regions #32274
This simplifies some logic in `languagetree.lua`, removing the need for
`_has_regions`, and removing side effects in `:included_regions()`.

Before:
- Edit is made which sets `_regions = nil`
- Upon the next call to `included_regions()` (usually right after we
  marked `_regions` as `nil` due to an `_iter_regions()` call), if
  `_regions` is nil, we repopulate the table (as long as the tree
  actually has regions)

After:
- Edit is made which resets `_regions` if it exists
- `included_regions()` no longer needs to perform this logic itself, and
  also no longer needs to read a `_has_regions` variable
2025-02-02 03:42:47 -08:00