Commit Graph

8300 Commits

Author SHA1 Message Date
zeertzjq
5d2b6f4fa0
vim-patch:9.1.1095: tests: matchparen plugin test wrongly named (#32397)
Problem:  tests: matchparen plugin test wrongly named
          (zeertzjq)
Solution: rename test_matchparen to test_plugin_matchparen
          to be consistent with the other plugin tests

related: vim/vim#16599

7de6b1bb56

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-02-11 09:07:47 +08:00
Justin M. Keyes
a1906c23dd fix(ui): Windows :detach is opt-in
Problem:
On Windows, spawning the `nvim --embed` server with `detach=true` breaks
various `tt.setup_child_nvim` tests.

Solution:
Make this behavior opt-in with an env var, temporarily.
2025-02-10 18:56:11 +01:00
Justin M. Keyes
69abeaad1d test: use --clean 2025-02-10 18:56:11 +01:00
Justin M. Keyes
4b0e2605ea feat(ui): UI :detach command
Problem:
Cannot detach the current UI.

Solution:
- Introduce `:detach`.
- Introduce `Channel.detach`.

Co-authored-by: bfredl <bjorn.linse@gmail.com>
2025-02-10 18:56:11 +01:00
Cai Rijun (Richard)
ad60b3fb48
fix(api): memory leaks in vim.api.nvim_*get_option #32390
Problem: `get_option_value` returns caller owned `Object`s but the
corresponding C apis do not marked `FUNC_API_RET_ALLOC` properly.

Solution: add `FUNC_API_RET_ALLOC` to the C apis.
2025-02-10 09:37:36 -08:00
fredizzimo
524cdd35c2
test(fix): make testing of ext_cmdline optional #32375 2025-02-10 05:51:04 -08:00
Christian Clason
ad8e0cfc1d vim-patch:f30eb4a: runtime(qf): Update syntax file, match second delimiter
Match both | separators and link to the Delimiter highlight group.

fixes vim/vim#16584
closes: vim/vim#16590

f30eb4a170

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-02-10 09:33:23 +01:00
zeertzjq
a80023c3f8 vim-patch:9.1.1091: tests: timeout might be a bit too small
Problem:  tests: timeout might be a bit too small
Solution: increase the test timeout from 30 to 45 seconds

related: vim/vim#16599

ec7a4e4d69

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-02-10 11:34:23 +08:00
zeertzjq
82a088551f vim-patch:9.0.1675: test may run into timeout when using valgrind
Problem:    Test may run into timeout when using valgrind.
Solution:   Use a longer timeout when using valgrind.

7c2beb48ef

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-02-10 11:33:06 +08:00
zeertzjq
bb31814033
vim-patch:partial:9.1.1088: tests: plugin tests are named inconsistently (#32388)
Problem:  tests: plugin tests are named inconsistently
Solution: group them under a common 'plugin' prefix

related: vim/vim#16599

934d9ab3a2

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-02-10 11:27:13 +08:00
neeshy
59a171fd99
fix(defaults): improve visual search mappings #32378
Problem: The behavior of the visual search mappings aren't consistent
with their normal mode counterparts.
  - The count isn't considered
  - Searching with an empty selection will match every character in the
    buffer
  - Searching backwards only jumps back when the cursor is positioned at
    the start of the selection.

Solution:
  - Issue `n` `v:count1` times
  - Error out and exit visual mode when the selection is empty
  - Detect when the cursor is not at the start of the selection, and
    adjust the count accordingly

Also, use the search register instead of the more error-prone approach
of feeding the entire search string as an expression
2025-02-09 13:23:30 -08:00
phanium
cd3855fb2b
fix(lua): vim.tbl_get({}, nil, 1) should return nil #32218
Problem:
`vim.tbl_get(tbl, nil, 1)` returns `tbl` itself. In this case, `keys` is not
empty, but `ipairs` skips the iteration:

    local keys = { nil, 1 }
    assert(#keys == 2)
    for i, k in ipairs(keys) do
      assert(false, 'unreachable')
    end

Solution:
Use `select("#", ...)` and `select(i, ...)` to ensure consistency for count and
iteration.
2025-02-09 08:40:43 -08:00
fredizzimo
8c2571991a
test: reset cmdline abort state only after expect() has finished #32376
Problem:
cmdline abort state may be reset when intermediate states are received.

Solution:
Reset after `self:_wait()`.
2025-02-09 07:44:41 -08:00
fredizzimo
af0cd9a907
test: screen.lua can check win_pos #32373
Also remove a hack in the multigrid "with winbar" test.
2025-02-09 07:31:14 -08:00
Christian Clason
9198368f32 vim-patch:9.1.1085: filetype: cmmt files are not recognized
Problem:  filetype: cmmt files are not recognized
Solution: detect '*.cmmt' as trace32 filetype
          (Christian Sax)

"*.cmmt" files use the same syntax as regular TRACE32 scripts,
but are intended as a kind of script template.

closes: vim/vim#16598

746fe54d4f

Co-authored-by: Christoph Sax <c_sax@mailbox.org>
2025-02-09 11:08:53 +01:00
glepnir
53e737748e
vim-patch:9.1.1086: completion doesn't work with multi lines (#32377)
Problem:  completion doesn't work with multi lines
          (Łukasz Jan Niemier)
Solution: handle linebreaks in completion code as expected
          (glepnir)

fixes: vim/vim#2505
closes: vim/vim#15373

76bdb82527
2025-02-09 10:43:02 +08:00
zeertzjq
6f0a91579f vim-patch:9.1.1083: setreg() doesn't correctly handle mbyte chars in blockwise mode
Problem:  setreg() doesn't correctly handle mbyte chars in blockwise
          mode
Solution: use mb_ptr2len_len function pointer (Yee Cheng Chin)

setreg() will automatically calculate the width when a blockwise mode is
specified, but it does not properly calculate the line widths of mbyte
characters when value is passed as newline-terminated string. It does
work when value is passed as a list of lines though.

Fix this by properly using the mbyte function pointer to increment the
loop counter.

closes: vim/vim#16596

a17f8bfb28

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-02-09 08:46:55 +08:00
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
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
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
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
4317d36669
fix(event-loop): process input before events in getchar() (#32322)
Follow-up to #27358.
2025-02-05 06:48:56 +08: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
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
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
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
Maria José Solano
445ecca398
feat(diagnostic): format() can filter diagnostics by returning nil #32302 2025-02-03 00:54:31 -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
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
glepnir
3e882bf81c
vim-patch:9.1.1069: preinsert text completions not deleted with <C-W>/<C-U> (#32296)
Problem:  preinsert text completions not deleted with <C-W>/<C-U>
          (ddad431, after v9.1.1059)
Solution: handle <C-W> or <C-U> specifically and clear the completion
          (glepnir)

fixes: vim/vim#16557
closes: vim/vim#16565

001c26cd61
2025-02-02 10:02:25 +00:00
zeertzjq
4bdabf9b1a
vim-patch:9.1.1068: getchar() can't distinguish between C-I and Tab (#32295)
Problem:  getchar() can't distinguish between C-I and Tab.
Solution: Add {opts} to pass extra flags to getchar() and getcharstr(),
          with "number" and "simplify" keys.

related: vim/vim#10603
closes: vim/vim#16554

e0a2ab397f

Cherry-pick tv_dict_has_key() from patch 8.2.4683.
2025-02-02 09:32:51 +00:00
Felipe Vicentin
289c9d21cb
fix(autocmds): once=true Lua event-handler may call itself #29544
Problem:
Event handler declared with `once=true` can re-trigger itself (i.e. more
than once!) by calling `nvim_exec_autocmds` or `:doautocmd`.

Analysis:
This happens because the callback is executed before deletion/cleanup
(`aucmd_del`). And calling `aucmd_del` before `call_autocmd_callback`
breaks the autocmd execution...

Solution:
Set `ac->pat=NULL` to temporarily "delete" the autocmd, then restore it
after executing the callback.

Fix #25526

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-02-01 16:25:38 -08:00
zeertzjq
0985e784d8
vim-patch:9.1.1065: no digraph for "Approaches the limit" (#32289)
Problem:  no digraph for "Approaches the limit"
Solution: Add the digraph using .= (Hans Ginzel)

Add digraph Approaches the Limit

≐ U+2250 https://www.fileformat.info/info/unicode/char/2250/index.htm

closes: vim/vim#16508

3a621188ee

Co-authored-by: Hans Ginzel <hans@matfyz.cz>
2025-02-02 07:00:45 +08:00
Riley Bruins
096ae3bfd7 fix(treesitter): nil access when running string parser async 2025-02-01 17:02:52 +01:00