Commit Graph

31806 Commits

Author SHA1 Message Date
zeertzjq
7f3157f3f6 vim-patch:9.1.1101: insexpand.c hard to read
Problem:  insexpand.c hard to read
Solution: refactor slightly to make it better readable
          (glepnir)

Problem:
- Complex while loops with nested conditions
- Redundant if branches
- Hard to understand and maintain

Solution:
- Restructure using while(true) with clear break conditions
- Using ternary to replace some if conditions
- Add descriptive comments for each step

closes: vim/vim#16600

40891bac5d

Co-authored-by: glepnir <glephunter@gmail.com>
2025-02-11 09:33:42 +08:00
zeertzjq
b7020e263e vim-patch:9.1.1098: leaking memory with completing multi lines
Problem:  leaking memory with completing multi lines
          (after v9.1.1086)
Solution: free allocated memory (glepnir)

closes: vim/vim#16605

e3647c8bf5

Co-authored-by: glepnir <glephunter@gmail.com>
2025-02-11 09:33:41 +08:00
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
c7d13f2895
Merge #32385 UI :detach command 2025-02-10 10:21: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
Siddhant Agarwal
06d8dd89fd
refactor(defaults): cleanup enable_ctx_menu #32391
The ctx parameter is not needed since various refactors.
2025-02-10 05:18:01 -08:00
Lewis Russell
e1dc824b7e
build: set luals checklevel to Hint #32392 2025-02-10 03:04:01 -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
e6b84fab83
Merge pull request #32389 from zeertzjq/vim-9.0.1675
vim-patch:9.{0.1675,1.1091}
2025-02-10 12:46:25 +08: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
Siddhant Agarwal
ac207c3ac2
feat(defaults): "Show Diagnostics" in mouse popupmenu #32122
Problem:
No obvious way to see diagnostics without configuring it first.
Solution:
Add `Show Diagnostics`, `Show All Diagnostics` and `Configure
Diagnostics` buttons to the context menu.
2025-02-09 11:32:12 -08:00
Shantanu Raj
24d7debdfb
fix(lsp): signature_help highlights wrong parameter #32382
Problem:
With some LSP servers, `vim.lsp.buf.signature_help` (CTRL-s in insert-mode)
highlights the first parameter regardless of the current cursor position.

- On some lsps the `textDocument/signatureHelp` response only includes the
  `activeParameter` field on the `lsp.SignatureHelp` object.
  ```lua
  {
    {
      result = {
        activeParameter = 2,
        signatures = {
          {
            documentation = {
              kind = "markdown",
              value = ""
            },
            label = "getBuyers(ctx context.Context, orderDB boil.ContextExecutor, supplierID string) ([]*BuyerWithLocation, error)",
            parameters = {
              {
                label = "ctx context.Context"
              },
              {
                label = "orderDB boil.ContextExecutor"
              },
              {
                label = "supplierID string"
              }
            }
          }
        }
      }
    }
  }
  ```

Solution:
Ensure we retain this information before showing the signature information.

Closes #32381
2025-02-09 10:02:46 -08:00
dundargoc
198a952c13 build: add luals check
This automatically downloads and uses the correct luals binary for the
currently used system. `make luals` will run luals on all lua files in
`runtime`.

We download lua-language-server manually instead of relying on
contributors downloading it on their own (like with stylua) as
lua-language-server is updated frequently which may cause unnecessary
friction. Therefore, we download a pinned version of luals which we then
can manually bump when needed. This can be re-evaluated if luals becomes
more stable in the future.

Currently this is not run when using `make lint` since cmake style "file
caching" doesn't seem possible at the moment. This is because checking a
single file doesn't seem to work.

Work on https://github.com/neovim/neovim/issues/24563.
2025-02-09 18:10:54 +01: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
ec3071ffad
Merge pull request #32374 from zeertzjq/vim-8.2.2933
vim-patch:8.2.{2933,2934,2935},9.1.1083
2025-02-09 09:19:05 +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
zeertzjq
00bce2723f vim-patch:8.2.2935: calculating register width is not always needed
Problem:    Calculating register width is not always needed. (Christian
            Brabandt)
Solution:   Only calculate the width when the type is MBLOCK.

6c4c404c58

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-02-09 08:30:32 +08:00
zeertzjq
9afc1f0f3b vim-patch:8.2.2934: ASAN error when using text from the clipboard
Problem:    ASAN error when using text from the clipboard.
Solution:   Get width of each character.

24951a67c2

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-02-09 08:26:44 +08:00
zeertzjq
9dc5e2100f vim-patch:8.2.2933: when 'clipboard' is "unnamed" zp does not work correctly
Problem:    When 'clipboard' is "unnamed" zp and zP do not work correctly.
Solution:   Pass -1 to str_to_reg() and fix computing the character width
            instead of using the byte length. (Christian Brabandt,
            closes vim/vim#8301, closes vim/vim#8317)

6e0b553fa1

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-02-09 08:19:25 +08:00
Christian Clason
59edd7c88a
vim-patch:a35040f: runtime(tex): improve syntax highlighting (#32370)
this change includes the following changes:
- a macro option must be #1–#9
- add \providecommand
- add starred versions of \newcommand, \newenvironment, and their
  variants
- add number of arguments to \(re)newenvironment

a35040f795

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-02-09 07:41:37 +08:00
dundargoc
818a2980db ci(arm64): skip installing npm to prevent segmentation faults
Installing npm on linux arm64 causes intermittent segmentation faults
for unknown reasons.

Closes https://github.com/neovim/neovim/issues/32339.
2025-02-08 14:14:42 +01:00
Evgeni Chasnovski
a9cdf76e3a 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.
2025-02-07 22:10:59 +00: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
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