Commit Graph

9292 Commits

Author SHA1 Message Date
zeertzjq
f8b50bf3b0 vim-patch:9.1.1825: completion: flicker when LSP server is slow (#36020)
Problem:  completion: flicker when LSP server is slow
Solution: reinsert leader text before invoking user function
          (Girish Palya)

Reference:
https://github.com/girishji/vimcomplete/issues/101#issuecomment-3343063245

In insert-mode completion, the leader text is temporarily removed while
searching for candidates. When the LSP server responds slowly, the
client may call `:sleep` to wait, which triggers `out_flush()`. This
causes the deleted text to disappear briefly before being redrawn,
resulting in visible flicker.

This commit reinserts the leader text before invoking the user function,
and removes it again afterward to eliminate flicker.

closes: vim/vim#18468

c51d1cc578

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-10-04 12:08:28 +00:00
zeertzjq
94bd212dbc vim-patch:9.1.1824: tests: no test for displaying 'foldcolumn' with Unicode "foldinner" (#36019)
Problem:  tests: no test for displaying 'foldcolumn' with Unicode
          "foldinner" in 'fillchars'.
Solution: Add a few more test cases.  Also fix misplaced "foldinner"
          entry in version9.txt (zeertzjq).

closes: vim/vim#18483

bcf44668f6
2025-10-04 11:43:23 +00:00
glepnir
19f5f05ac2 fix(api): nvim_open_win respects requested split window size (#35601)
Problem: requested window size passed to nvim_open_win for splits may be ignored
by win_split_ins if it decides to forcefully equalize window sizes instead (e.g:
in an attempt to make room for the new window).

Solution: try to set the size again if it differs from what was requested.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-10-04 09:07:27 +01:00
zeertzjq
40bf38fefc fix(terminal): handle OSC 8 split into multiple fragments
Also fix off-by-one size passed to xmemdupz().
2025-10-04 08:35:15 +08:00
zeertzjq
f64475a226 fix(tui): handle sequence larger than entire buffer 2025-10-04 07:54:50 +08:00
zeertzjq
b6b80824cc vim-patch:9.1.1819: Cannot configure the inner foldlevel indicator (#36010)
Problem:  Cannot configure the inner foldlevel indicator for the
          foldcolumn
Solution: Add "foldinner" suboption value to the 'fillchar' option
          (Maria José Solano).

closes: vim/vim#18365

1a691afd27

Co-authored-by: Maria José Solano <majosolano99@gmail.com>
2025-10-03 23:53:29 +00:00
zeertzjq
2c76a50e20 vim-patch:9.1.1821: filetype: Not all PKL files are recognized (#36008)
Problem:  filetype: Not all PKL files are recognized
Solution: Detect *.pcf as pkl filetype, detect using the pkl-lsp://
          protocol as pkl filetype, include PKL syntax script
          (Jan Claußen)

This adds basic syntax support for the new PKL language by Apple.

What works:
- Shebang support
- Comment support
- Integers (decimal, hex, octal and binary) support
- Floating point support including exponentials
- Basic datatype support
- Unicode escape delimiters
- Escape code support
- String interpolation
- Support up to five pounds for custom delimiters
- Folding of multi-line comments and blocks

What doesn't work:

  The language heavily uses parameterized type declarations, which can get
  very complex. It is very hard to highlight this properly. There is
  official Tree-sitter support for this. Since it is hard to pull this off
  in a vim syntax file, I opted for basic support of the data types.

References:
  https://github.com/apple/pkl-pantry

fixes: vim/vim#18271
closes: vim/vim#18274

67a8f2945e

Co-authored-by: Jan Claußen <jan.claussen10@web.de>
2025-10-04 06:01:16 +08:00
zeertzjq
8151fc59cf vim-patch:9.1.1820: completion: some issues with 'acl' (#36007)
Problem:  completion: some issues with 'acl' when "preinsert" and
          "longest" is in 'completeopt' (musonius, after v9.1.1638)
Solution: Fix various issues (see details below) (Girish Palya)

This commit addresses multiple issues in the 'autocompletedelay' behavior with
"preinsert" and "longest":

- Prevents spurious characters from being inserted.
- Ensures the completion menu is not shown until `autocompletedelay` has
  expired.
- Shows the "preinsert" effect immediately.
- Keeps the "preinsert" effect visible even when a character is deleted.

fixes: vim/vim#18443
closes: vim/vim#18460

f77c187277

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-10-03 13:10:05 +00:00
zeertzjq
97ab7dd784 test(tui_spec): deduplicate (#36003) 2025-10-03 10:25:04 +00:00
Riley Bruins
ac15b384a6 refactor(treesitter): use scratch buffer for string parser #35988
This commit changes `languagetree.lua` so that it creates a scratch
buffer under the hood when dealing with string parsers. This will make
it much easier to just use extmarks whenever we need to track injection
trees in `languagetree.lua`. This also allows us to remove the
`treesitter.c` code for parsing a string directly.

Note that the string parser's scratch buffer has `set noeol nofixeol` so
that the parsed source exactly matches the passed in string.
2025-10-02 15:33:18 -07: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
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
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
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
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
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
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
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
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
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
glepnir
69cae6259e fix(cmd): :update does not write new, unmodified buffer #35929
Problem: update command does not write new buffers that have
filenames but no corresponding file on disk, even when using ++p flag.

Solution: allow update to write when buffer has filename but file
doesn't exist.
2025-09-27 10:24:24 -07:00
zeertzjq
2aab242a01 vim-patch:9.1.1798: Wrong display with 'sms' and long wrapped virt text at EOL (#35930)
Problem:  Wrong display with 'smoothscroll' and long wrapped virtual
          text at EOL.
Solution: Handle w_skipcol inside long wrapped virtual text at EOL
          (zeertzjq).

closes: vim/vim#18408

d9318acc02
2025-09-27 13:28:40 +00:00
zeertzjq
42aae632be fix(plines): count 'showbreak' in EOL inline virt_text in line size (#35921) 2025-09-26 04:08:38 +00:00
zeertzjq
a0a86fdc04 test: make preload of functional/testnvim.lua explicit (#35919)
Before functional/testnvim.lua was moved from functional/testutil.lua in
052498ed42, it was explicitly preloaded,
but now it is preloaded implicitly via functional/ui/screen.lua.

Also fix warnings about unused variables in other preload.lua files.
2025-09-26 09:05:07 +08:00
zeertzjq
d9fa495608 vim-patch:9.1.1790: completion: Enter does not insert match with "noinsert" (#35917)
Problem:  completion: Enter does not insert match with "noinsert".
          (Sergey Vlasov)
Solution: Check for compl_shown_match instead of compl_selected_item
          (zeertzjq).

fixes: vim/vim#18386
related: vim/vim#1653
closes: vim/vim#18395

ef818ae444
2025-09-25 23:37:02 +00:00
zeertzjq
bfa3e111c2 test(unit): disable JIT when using mocks (#35913)
This fixes the flaky eval/typval_spec.lua tests.
2025-09-26 05:59:05 +08:00
zeertzjq
eb7c12d3e3 test: remove a few more redundant clear() calls (#35903) 2025-09-24 14:25:54 +08:00
zeertzjq
b256e0476b test(lua/secure_spec): clean up properly (#35902)
- Remove "state" directory after each test, so that a failure in one
  test won't interfere with later tests.
- Still make sure the trust file is empty at the end of each test.
2025-09-24 12:30:57 +08:00
zeertzjq
a62fb57e58 test: don't call clear() in both before_each() and after_each() (#35901) 2025-09-24 11:41:43 +08:00
zeertzjq
94f1abf89c test(tui_spec): avoid dangling Nvim processes on test failure (#35900)
Also don't wait indefinitely for all Nvim processes to exit.
2025-09-24 02:21:42 +00:00
zeertzjq
0c23b863f4 vim-patch:9.1.1787: filetype: not all Sway config files are recognized
Problem:  filetype: not all Sway config files are recognized
Solution: Detect files within */sway/config.d/* as swayconfig filetype
          (Felix Pehla).

Sways default config automatically includes files placed in
@sysconfdir@/sway/config.d/* (see config.in), so it makes sense to use
the sway syntax for those.

related: vim/vim#18293

24f0dbba8c

Co-authored-by: Felix Pehla <29adc1fd92@gmail.com>
2025-09-24 08:36:53 +08:00
zeertzjq
d2257402e3 test: don't block to wait for previous session's exit (#35885)
This reduces the time taken by clear() by over 20% with ASAN.
2025-09-23 23:25:29 +00:00
luukvbaal
3d5ef97a98 fix(message): no wait return for delayed exception error #35881
Problem:  Wait return for delayed exception error message.
Solution: Check that error was actually shown.
2025-09-23 13:35:08 -07:00
zeertzjq
b9dd3167f4 test: remove duplicate legacy/{increment,undolevels}_spec.lua
They are almost exact copies of parts of test_{increment,undo}.vim.
2025-09-22 14:03:42 +08:00
zeertzjq
6d280804f7 test: make error clearer for RPC request after crash 2025-09-22 14:03:42 +08:00
zeertzjq
777dafdc46 test: reduce some clear() calls
Use only a single clear() call in some test/functional/vimscript/ test
files whose test cases have very little side effect.

A downside of using a single clear() is that if a crash happens in one
test case, all following test cases in the same file will also fail, but
these functionalities and tests don't change very often.
2025-09-22 14:03:42 +08:00
zeertzjq
c2136e3590 fix(options): increase t_Co buffer size (#35859) 2025-09-21 04:12:37 +00:00
zeertzjq
f60f67c2de test: fix 'autocompletedelay' test flakiness (#35856) 2025-09-21 01:27:44 +00:00
zeertzjq
a70997442e vim-patch:9.1.1779: completion: 'autocomplete' cannot be enabled per buffer (#35853)
Problem:  completion: 'autocomplete' cannot be enabled per buffer
          (Tomasz N)
Solution: Make 'autocomplete' global or local to buffer (Girish Palya)

fixes: vim/vim#18320
closes: vim/vim#18333

0208b3e80a

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-21 00:56:38 +00:00
zeertzjq
f91d416403 vim-patch:9.1.1776: completion: "adding" expansion doesn't work with cfc=keyword (#35850)
Problem:  "adding" expansion doesn't work with cfc=keyword.
Solution: Remove incorrect assignment to compl_cont_status. Don't use
          fuzzy collection in "adding" status (zeertzjq).

related: neovim/neovim#35842
closes: vim/vim#18351

e19a882ffc
2025-09-21 07:35:14 +08:00
zeertzjq
d3bd1fba6a vim-patch:9.1.1777: Mouse click to open fold doesn't work with utf-8 "foldclose" chars (#35851)
Problem:  Mouse click to open fold doesn't work with utf-8 "foldclose"
          chars (Balki)
Solution: Use ScreenLinesUC[off] if it is set (zeertzjq).

fixes: vim/vim#18344
closes: vim/vim#18349

8b5fe7d090
2025-09-21 07:32:25 +08:00
zeertzjq
a5955e5cc5 vim-patch:9.1.1778: sha256() treats empty blob and null blob differently
Problem:  sha256() treats empty blob and null blob differently
          (after 9.1.1774).
Solution: Handle null blob the same as empty blob (zeertzjq).

closes: vim/vim#18341

2f3b7ea19a
2025-09-21 06:31:27 +08:00