Commit Graph

34043 Commits

Author SHA1 Message Date
zeertzjq
28ccebd138 Merge pull request #35987 from zeertzjq/vim-9.1.1818
vim-patch:9.1.{partial:1110,1818}
nightly
2025-10-02 12:57:19 +08:00
zeertzjq
df0b9e7a5d vim-patch:9.1.1818: possible crash when calculating topline in diff.c
Problem:  possible crash when calculating topline in diff.c
          (youngmith)
Solution: Check for pointer being Null before accessing it

fixes: vim/vim#18437

d32b3bb7eb

The POC is likely not applicable to Nvim due to #32160.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-10-02 12:36:15 +08:00
zeertzjq
dfd3ac6f48 vim-patch:partial:9.1.1110: Vim tests are slow and flaky
Problem:  Vim tests are slow and flaky at the same time due to reliance
          on timeouts which are unreliable.
Solution: improve Vim test performance and reduce flakiness
          (Yee Cheng Chin)

A lot of Vim tests currently rely on waiting a specific amount of time
before asserting a condition. This is bad because 1) it is slow, as the
timeout is hardcoded, 2) it's unreliable as a resource-starved runner
may overshoot the timeout. Also, there are a lot of builtin sleep
commands in commonly used utilities like VerifyScreenDump and WaitFor()
which leads to a lot of unnecessary idle time.

Fix these issues by doing the following:
1. Make utilities like VerifyScreenDump and WaitFor use the lowest wait
   time possible (1 ms). This essentially turns it into a spin wait. On
   fast machines, these will finish very quickly. For existing tests
   that had an implicit reliance on the old timeouts (e.g.
   VerifyScreenDump had a 50ms wait before), fix the tests to wait that
   specific amount explicitly.
2. Fix tests that sleep or wait for long amounts of time to instead
   explicitly use a callback mechanism to be notified when a child
   terminal job has finished. This allows the test to only take as much
   time as possible instead of having to hard code an unreliable
   timeout.

With these fixes, tests should 1) completely quickly on fast machines,
and 2) on slow machines they will still run to completion albeit slowly.
Note that previoulsy both were not true. The hardcoded timeouts meant
that on fast machines the tests were mostly idling wasting time, whereas
on slow machines, the timeouts often were not generous enough to allow
them to run to completion.

closes: vim/vim#16615

e70587dbdb

Part of shared.vim and test_crash.vim changes only.

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-10-02 12:18:16 +08:00
zeertzjq
9f33b69cfd vim-patch:cfcf1a5: runtime(doc): Clarify use of "noselect" in 'completeopt'
closes: vim/vim#18452

cfcf1a57cb

Co-authored-by: Girish Palya <girishji@gmail.com>
Co-authored-by: Tomasz N <przepompownia@users.noreply.github.com>
2025-10-02 11:40:36 +08:00
zeertzjq
3f422cb5eb vim-patch:6e28211: runtime(doc): Tweak documentation style
closes: vim/vim#18462

6e282117c7

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-10-02 11:40:36 +08:00
Sergei Slipchenko
a1bc5d0ae6 fix(diagnostics): showing stale diagnostics in handlers #35890
Fixes #35884

Problem: Since `once_buf_loaded` might call a callback passed to it at a
later point (which is it's reason to exist) that callback might end up
referring to stale diagnostics in a handler's `show` function. For
example, if we first call `vim.diagnostic.set` for an unloaded buffer,
then call `vim.diagnostic.reset` and only then load the buffer, we might
still see diagnostics from `vim.diagnostic.set` call, which are stale at
this point.

Solution: only keep one autocommand from the most reset `show` call and
delete it when `hide` is called.
2025-10-01 20:17:55 -07:00
Justin M. Keyes
237827a0da test: normalize test filepath #35983
Problem:
Inconsistet slashes in Windows CI:

    ERROR test/functional\ex_cmds\mksession_spec.lua @ 36: ...

Solution:
Normalize the slashes.

    ERROR test/functional/ex_cmds/mksession_spec.lua @ 36: ...
2025-10-01 19:08:10 -07:00
zeertzjq
d72c805e87 vim-patch:8337d77: runtime(netrw): MS-Windows: fix netrw not being able to navigate to parent folder (#35982)
fixes: vim/vim#18421
closes: vim/vim#18464

8337d77eff

Co-authored-by: Miguel Barro <miguel.barro@live.com>
2025-10-02 01:57:53 +00:00
zeertzjq
c12efc50a9 vim-patch:a644b79: runtime(optwin): Update formatting of option descriptions (#35980)
closes: vim/vim#18446

a644b7924d

Co-authored-by: RestorerZ <restorer@mail2k.ru>
2025-10-02 09:06:41 +08:00
zeertzjq
39c0425c4c vim-patch:0977c8b: runtime(vim): Update base syntax, contain user command replacement text (#35979)
Ensure that :command replacement text terminates at the end of the
logical line.

Add :command to the generator exclusion list.

fixes: vim/vim#18414 (@Dougaak)
fixes: vim/vim#18448 (Maxim Kim)
closes: vim/vim#18415

0977c8b03e

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-10-02 00:41:04 +00:00
Riley Bruins
b4016f4525 fix(treesitter): don't add final newline if not present #35970
**Problem(?):** Buffers that (for whatever reason) aren't meant to have
a final newline are still parsed with a final newline in `treesitter.c`.

**Solution:** Don't add the newline to the last buffer line if it
shouldn't be there. (This more closely matches the approach of
`read_buffer_into()`.)

This allows us to, say, use a scratch buffer with `noeol` and `nofixeol`
behind the scenes in `get_string_parser()`.

...which would allow us to track injection trees with extmarks in that
case.

...which would allow us to not drop previous trees after reparsing a
different range with `get_parser():parse()`.

...which would prevent flickering when editing a buffer that has 2+
windows to it in view at a time.

...which would allow us to keep our sanity!!!

(one step at a time...)
2025-10-01 17:31:52 -07:00
zeertzjq
89dc889c3d Merge pull request #35978 from zeertzjq/vim-9.1.0689
vim-patch:9.1.{0689,0695,0698}
2025-10-02 08:26:44 +08:00
zeertzjq
532cc88604 vim-patch:9.1.0698: tests: "Untitled" file not removed when running Test_crash1_3 alone
Problem:  tests: "Untitled" file not removed when running Test_crash1_3 alone
          with TEST_FILTER (after v9.1.0695)
Solution: Use a TearDown function instead of another test.
          (zeertzjq)

closes: vim/vim#15578
closes: vim/vim#15577

d56c451e1c
2025-10-02 07:55:58 +08:00
zeertzjq
71662bbb49 vim-patch:9.1.0695: tests: test_crash leaves Untitled file around
Problem:  tests: test_crash leaves Untitled file around
Solution: cleanup at the end of the test_crash.vim test file

cd83173def

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-10-02 07:55:41 +08:00
zeertzjq
69a9a25fcc vim-patch:9.1.0689: [security]: buffer-overflow in do_search() with 'rightleft'
Problem:  buffer-overflow in do_search() with 'rightleft'
          (SuyueGuo)
Solution: after reversing the text (which allocates a new buffer),
          re-calculate the text length

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-v2x2-cjcg-f9jm

cacb6693c1

Add missing change from patch 8.1.1270.
Omit `call delete('Untitled')`: moved again in patch 9.1.0695.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-10-02 07:52:18 +08:00
zeertzjq
43f7434bd5 vim-patch:014c731: runtime(doc): make :h virtcol() more accurate (#35976)
The current description (especially the "unlimited width" part) is
inaccurate in several ways:
- The size of virtual text can depend on window width. In particular,
  the size of "above" virtual text can be equal to window width.
- A double-width character that doesn't fit adds 1 to the virtual column
  of the following characters.
- The size of 'showbreak' and 'breakindent' is counted.

related: vim/vim#5713
closes: vim/vim#18447

014c731fa5
2025-10-01 23:33:36 +00:00
v1nh1shungry
70460d557c fix(lsp): scope inline_completion autocmds to buffer (#35965)
Problem:
Autocmds in inline_completion Completor are not scoped to specific
buffers. When multiple buffers have inline completion enabled, events
(InsertEnter, CursorMovedI, TextChangedP, InsertLeave) in any buffer
trigger callbacks for all Completor instances, causing incorrect
behavior across buffers.

Solution:
Add `buffer = bufnr` parameter to nvim_create_autocmd() calls to make
them buffer-local. Each Completor instance now only responds to events
in its own buffer.
2025-10-01 06:56:56 -07:00
崔书豪
a053186aa7 build: redundant variable in cmake/Deps.cmake #35924 2025-09-30 20:16:02 -07:00
zeertzjq
6d550f3cdb test(terminal/mouse_spec): forwarding works with resized grid (#35969) 2025-10-01 01:24:02 +00:00
glepnir
198c9e9bca fix(shada): preserve marks after delete across sessions (#35795)
Problem: Marks are lost after `:bdelete` because `ignore_buf()` filters
out unlisted buffers during shada mark processing.

Solution: Revert to original buffer checks for mark operations, avoiding
`!buf->b_p_bl` condition that incorrectly ignores deleted buffers.
2025-09-30 05:28:35 +00:00
zeertzjq
35fc4fda99 vim-patch:9.1.1799: completion: crash with autcompletion (#35963)
Problem:  completion: crash with autcompletion
          (Maxim Kim)
Solution: Rework remove_old_matches (Girish Palya)

fixes: vim/vim#18378
fixes: vim/vim#18390
fixes: vim/vim#18391
closes: vim/vim#18427

3aa2edb557

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-30 02:42:13 +00:00
zeertzjq
77545c0f3c Merge pull request #35962 from zeertzjq/vim-9.1.1797
vim-patch:9.1.{1797,1800,1810}
2025-09-30 09:54:02 +08:00
zeertzjq
756e55dc49 vim-patch:9.1.1810: completion: "longest" doesn't work for manual completion with 'ac'
Problem:  completion: "longest" doesn't work for manual completion when
          'autocomplete' is on (after 9.1.1800).
Solution: Only reset compl_get_longest when enabling autocompletion
          (zeertzjq).

closes: vim/vim#18430

b3966d6a8e
2025-09-30 09:32:33 +08:00
zeertzjq
f30a33858f vim-patch:9.1.1800: completion: strange behaviour with 'ac' completeopt=longest,preinsert
Problem:  completion: strange behaviour with 'ac'
          completeopt=longest,preinsert (zeertzjq)
Solution: Let preinsert take precedence (Girish Palya)

fixes: vim/vim#18410
closes: vim/vim#18428

d35e5e4237

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-30 09:32:33 +08:00
zeertzjq
e6b2255ac7 vim-patch:4edaf89: runtime(doc): improve preinserted() doc
Change the second "if" to "because", otherwise it may be misinterpreted
that preinserted() can return non-zero just because these options are
set.

closes: vim/vim#18409

4edaf89233
2025-09-30 09:32:33 +08:00
zeertzjq
7b9c063d11 vim-patch:9.1.1797: completion: autocompletion can be improved
Problem:  completion: autocompletion can be improved
Solution: Add support for "longest" and "preinsert" in 'autocomplete';
          add preinserted() (Girish Palya)

* Add support for "longest" in 'completeopt' when 'autocomplete'
  is enabled. (Note: the cursor position does not change automatically
  when 'autocomplete' is enabled.)
* Add support for "preinsert" when 'autocomplete' is enabled. Ensure
  "preinsert" works the same with and without 'autocomplete'
* introduce the preinserted() Vim script function, useful for defining
  custom key mappings.

fixes: vim/vim#18314
closes: vim/vim#18387

c05335082a

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-30 09:32:33 +08:00
zeertzjq
4896178863 vim-patch:05e44e9: runtime(tex): add amsmath support to tex syntax script (#35958)
Problem:  tex syntax file does not support some of the math equation
          environments provided by amsmath.sty, therefore well-formed
          snippet is highlighted as "texBadMath"
Solution: add the environments

closes: vim/vim#18433

05e44e978f

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-09-30 08:26:55 +08:00
zeertzjq
af2932e2dc vim-patch:992e307: runtime(doc): update list of modifiers at :h expand() (#35957)
fixes: vim/vim#18435

992e30774f

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-09-30 08:26:40 +08:00
zeertzjq
e7a03dd4e8 Merge pull request #35956 from zeertzjq/vim-9.1.1807
vim-patch:9.1.{1807,1808}
2025-09-30 07:10:18 +08:00
zeertzjq
42f1864b62 vim-patch:9.1.1808: Option insecure flags not copied when splitting window
Problem:  Option insecure flags not copied when splitting window.
Solution: Move window-local insecure flags to winopt_T and copy them
          properly (zeertzjq).

closes: vim/vim#18434

b3740f4b00
2025-09-30 06:45:36 +08:00
zeertzjq
ff564237d2 vim-patch:9.1.1807: :set doesn't clear local insecure flag like :setlocal does
Problem:  :set doesn't clear local insecure flag like :setlocal does.
Solution: Also clear the local insecure flag when using :set (zeertzjq).

This applies to local options like 'wrap', 'foldtext' and 'foldexpr',
whose global flags are actually never used.  For global-local options
like 'statusline' the behavior is already correct, so add some tests.

related: vim/vim#18434

fec5586a45
2025-09-30 06:36:50 +08:00
Jan Edmund Lazo
f2df98e849 vim-patch:8.2.0443: clipboard code is spread out #35949
Problem:    Clipboard code is spread out.
Solution:   Move clipboard code to its own file. (Yegappan Lakshmanan,
            closes vim/vim#5827)

45fffdf10b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-09-29 07:02:01 -07:00
Maria Solano
9da316fcc4 fix(docs): force blank line after numbered list items #35950
Workaround until the vimdoc parser supports numbered list-items:
https://github.com/neovim/tree-sitter-vimdoc/issues/144
2025-09-28 21:01:20 -07:00
Justin M. Keyes
2739ab485e docs: json, tests, lsp #35754
Close #35926
Close #35818

Co-authored-by: skewb1k <skewb1kunix@gmail.com>
Co-authored-by: glepnir <glephunter@gmail.com>
2025-09-28 20:57:59 -07:00
zeertzjq
af1b17f17e Merge pull request #35948 from zeertzjq/vim-72473ce
vim-patch: Vim syntax updates
2025-09-29 09:56:26 +08:00
zeertzjq
11b6fcdfa6 vim-patch:ae20d73: runtime(vim): Update base syntax, improve line-continuation skip patterns
Factor out the common prefix in line-continuation :syn-skip patterns.

closes: vim/vim#18416

ae20d732ae

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-09-29 09:23:42 +08:00
zeertzjq
7c9a4a2a71 vim-patch:f4a6acd: runtime(vim): Update base syntax, allow Vim9 :echo tail comments
- Match comments after Vim9 :echo and :execute.
- Match comments after Vim9 and legacy :eval.

closes: vim/vim#18420

f4a6acd86e

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-09-29 09:19:07 +08:00
zeertzjq
2cd899f730 vim-patch:7bb733f: runtime(vim): Update base syntax, match null_tuple literal
closes: vim/vim#18404

7bb733f6bf

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-09-29 09:17:13 +08:00
zeertzjq
e9d8d1b061 vim-patch:57d243e: runtime(vim): Update base syntax, fix indented Vim9 :redir highlighting
Include post operator whitespace in the Vim9 variable assignment
lookahead so that "redir =>" doesn't match as an assignment.

fixes: vim/vim#18319
closes: vim/vim#18323

57d243e27d

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-09-29 09:16:50 +08:00
zeertzjq
6b0365ae2f vim-patch:6f97624: runtime(vim): Update base syntax, fix Vim9 :for loop variable highlighting
Highlight the iteration variable's type in Vim9 :for {var} loops.

Reported by Aliaksei Budavei.

fixes: vim/vim#17961
closes: vim/vim#18163

6f97624e11

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-09-29 09:16:17 +08:00
zeertzjq
0ebb2ec4e4 vim-patch:4de931d: runtime(vim): Update base syntax, match enum constructor type args
closes: vim/vim#17840

4de931daae

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-09-29 09:15:17 +08:00
zeertzjq
22f6b9d11f vim-patch:72473ce: runtime(vim): Update base syntax, match generic functions
Match Vim9 generic functions, added in vim/vim#17313.

closes: vim/vim#17722

72473ce9f8

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-09-29 09:14:39 +08:00
zeertzjq
c07a24e31c vim-patch:91ac18c: runtime(java): Recognise _module_ import declarations (#35947)
After two preview proposals (JEPs 476 and 494), _module_
import declarations are now a part of the language (JDK 25).

Reference:
https://openjdk.org/jeps/511

closes: vim/vim#18424

91ac18cb03

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-09-29 01:03:42 +00:00
Maria Solano
8a76129d9f fix(docs): include ? in list items #35945 2025-09-28 17:13:35 -07:00
zeertzjq
0fa0717d4e vim-patch:9.1.1802: 'nowrap' in a modeline may hide malicious code (#35946)
Problem:  'nowrap' in a modeline may hide malicious code.
Solution: Forcibly use '>' as 'listchars' "extends" if 'nowrap' was set
          from a modeline (zeertzjq).

Manual `:setlocal nowrap` disables this behavior.  There is a separate
problem with `:set nowrap` that also applies to some other options.

related: vim/vim#18214
related: vim/vim#18399
closes: vim/vim#18425

9d5208a931

Cherry-pick some test_modeline.vim changes from patches 9.0.{0363,0626}.
2025-09-29 07:48:46 +08:00
glepnir
fcf752476a fix(cmd): :update writes new file buffers only for real files #35939
Problem: :update should write new file buffers, but previous fix
affected special buffer types (acwrite, nofile, etc.).

Solution: Add bt_nofilename() check to only write new files for
buffers representing real filesystem paths.
2025-09-27 20:28:05 -07:00
Maria Solano
03032d1f73 fix(lsp): remove vim.lsp.diagnostic.reset() (#35938) 2025-09-27 14:53:00 -07:00
Maria Solano
c5c6ddba91 feat(lsp): document method types (#35934) 2025-09-27 14:52:30 -07:00
Maria Solano
5fbc5ab810 fix(lsp): use correct workspace.diagnostics capability key (#35937) 2025-09-27 13:40:52 -07:00
Peter Aronoff
6063ecb649 build: remove reference to runtime/indent/Makefile (#35935)
`runtime/indent/Makefile` was removed in 2d8ed73, and now `make clean`
and `make distclean` fail since those jobs call `make -C runtime/indent
clean`

Remove call to `make -C runtime/indent clean`
2025-09-28 02:56:23 +08:00