Problem: A custom property containing a pair of square brackets will be
treated as a section.
Solution: Change the logic parsing a section, remove the first match
regex `%b[]`.
Signed-off-by: fortime <palfortime@gmail.com>
This commit also adds a type annotation to the returned client
capabilities table, because without it lua_ls does not provide
autocompletion for the fields within the table.
Add '^' and '$' around the pattern. This makes it less likely to make
mistakes of when writing tests with {MATCH:}, as most such tests have
text before and after {MATCH:}.
Limit heredoc matches to assignment statements. Matching these at the
top level is very slow.
closes: vim/vim#17473274efcc7e6
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: Session has wrong arglist with :tcd and :arglocal.
Solution: Also use absolute path for :argadd when there is tabpage-local
directory (zeertzjq).
related: neovim/neovim#34405closes: vim/vim#17503a304e49790
vterm does not send us the terminator in the string fragment. Our OSC 8
parser assumed that it was and therefore treated short strings as
invalid (as it assumed it was missing a terminator).
Uses the undocumented "error_exit" UI event for a different purpose:
When :detach is used on the server, send an "error_exit" with 0 `status`
to indicate that the server shouldn't wait for client exit.
Problem: 'nobuflisted' buffers are incorrectly added to v:oldfiles.
Solution: Use ignore_buf() consistently in shada_write() for buffer
marks processing.
Problem: negative matchfuzzy scores although there is a match
(Maxim Kim)
Solution: reset the score if a match has been found but the score is
negative (Girish Palya)
The fuzzy algorithm may miss some matches in long strings due to recursion
limits. As a result, the score can end up negative even when matches exist.
In such cases, reset the score to ensure it is non-negative.
fixes: #vim/vim#17449
closes: vim/vim#17469328332b0b0
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: potential buffer underflow in insertchar()
Solution: verify that end_len is larger than zero
(jinyaoguo)
When parsing the end-comment leader, end_len can be zero if
copy_option_part() writes no characters. The existing check
unconditionally accessed lead_end[end_len-1], causing potential
underflow when end_len == 0.
This change adds an end_len > 0 guard to ensure we only index lead_end
if there is at least one character.
closes: vim/vim#1747682a96e3dc0
Co-authored-by: jinyaoguo <guo846@purdue.edu>
Problem: tests: Test_diff_fold_redraw() is insufficient
(after v9.1.1439, Christ van Willegen)
Solution: improve the test (Gary Johnson)
The original Test_diff_fold_redraw() function, added 2025-06-08 at patch
9.1.1439, had a bug and didn't do a very good job of testing the fold
behavior. This new version is simpler and more thorough.
The bug was that it checked the fold state of one window twice instead
of checking both windows.
closes: vim/vim#1749269565e3618
Co-authored-by: Gary Johnson <garyjohn@spocom.com>
Problem: completion: code can be improved
Solution: remove reposition_match() and use mergesort_list(),
for fuzzy completion, sort by fuzzy score immediately after
setting a new leader (Girish Palya)
closes: vim/vim#17460b8ee1cf56e
Co-authored-by: Girish Palya <girishji@gmail.com>
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: Since 48e2a736, prompt messages are handled by an actual
active cmdline, resulting in `State` no longer being equal
to `MODE_CONFIRM` which is used in some places. E.g. to
specify the current `mode()` or to re-emit a confirm message.
Solution: Replace `MODE_CONFIRM` with a new `MODE_CMDLINE` sub-mode when
`ccline.one_key/mouse_used` is set. Use it to avoid clearing
mouse_used prompt messages, and to re-emit one_key messages
(when ext_messages is inactive, for which this is unnecessary).
Problem: When using 'winblend', transparent backgrounds (-1) are forced
to default colors (usually black) during attribute blending, breaking
the transparency effect.
Solution: Check original background colors before blending in
hl_blend_attrs(). If both background and foreground originally had
transparent backgrounds, preserve transparency instead of forcing
default colors.
Problem:
- nvim_parse_cmd('copen', {}) returns count: 0, causing nvim_cmd to override default behavior
- nvim_cmd({cmd = 'copen', args = {10}}, {}) fails with "Wrong number of arguments"
Solution:
- Only include count field in parse result when explicitly provided or non-zero
- Interpret single numeric argument as count for count-only commands like copen
FAILED
test/functional/treesitter/fold_spec.lua
@
720
:
treesitter foldexpr doesn't open folds that are not touched
test/functional/treesitter/fold_spec.lua:767: Row 1 did not match.
Expected:
|*{1:-}^t1 |
|*{1:-}# h2 |
|*{1:│}t2 |
|{3:~ }|
|{3:~ }|
|{3:~ }|
|{3:~ }|
|1 line less; before #2 {MATCH:.*}|
Actual:
|*{1: }^t1 |
|*{1:+}{2:+-- 2 lines: # h2·····················}|
|*{3:~ }|
|{3:~ }|
|{3:~ }|
|{3:~ }|
|{3:~ }|
|1 line less; before #2 0 seconds ago |
To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.
Snapshot:
screen:expect([[
{1: }^t1 |
{1:+}{2:+-- 2 lines: # h2·····················}|
{3:~ }|*5
1 line less; before #2 0 seconds ago |
]])
Problem:
Test often fails on cirrus CI (freebsd):
buffer cursor position is correct in terminal with number column in a line with single-cell multibyte chars and no trailing spaces, before_each
test/functional/terminal/cursor_spec.lua:805: Row 5 did not match.
Expected:
|{7: 1 } |
|{7: 2 } |
|{7: 3 } |
|{7: 4 } |
|*{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|{7: 6 }:^ |
|{3:-- TERMINAL --} |
Actual:
|{7: 1 } |
|{7: 2 } |
|{7: 3 } |
|{7: 4 } |
|*{7: 5 } |
|{7: 6 }:^ |
|{3:-- TERMINAL --} |
Solution:
Skip it. Ex mode isn't that important.
Problem: A 'winblend' window floating over uninitialized cells loses
its highlighting.
Solution: Return the front attribute for uninitialized background cells.
I guess these kinds of DRY techniques are kinda cutesy but unfortunately
I cannot expand macros invoking macros with various kind of syntax
fragments and back-references to local variables, at the same time
as I try to understand what is actually going on when you :wshada or :rshada
your jump marks, some of which having fname:s in them and some not.
This replaces it with four spelled out loops, although it is fine to
keep the memmove() related code generic in the item size just by passing a
runtime parameter (we have generics at home). Galaxy brain -03 -flto compilers
are gonna inline it anyway if it is worth it.
Problem: `exists()` checks should test for being equal to 1 rather than truthy, and extui check can be more restrictive.
Solution: Adjust `exists()` guards to equal 1 and use `matchparen#CursorMoved`.
Problem: Error occurs if window is invalid in the middle of parsing.
Solution: Check if window is valid in parsing.
- Error
```
vim.schedule callback: ...im/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:485: Invalid window id: 1037
stack traceback:
[C]: in function 'nvim__redraw'
...im/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:485: in function 'cb'
...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:494: in function '_run_async_callbacks'
...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:550: in function <...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:529>
```
- Reproduce script
```lua
local bufnr = vim.api.nvim_create_buf(false, true)
local many_lines = vim.fn["repeat"]({ "local test = 'a'" }, 100000)
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, many_lines)
local window = vim.api.nvim_open_win(bufnr, true, {
relative = "editor",
row = 0,
col = 0,
width = 10,
height = 10,
})
vim.bo.filetype = "lua"
vim.schedule(function()
vim.api.nvim_win_close(window, true)
end)
```
Problem: Last diff folds not merged (after v8.1.1922)
Solution: loop over all windows in the current tabpage and update all
folds (Gary Johnson)
This commit fixes a bug where the last two folds of a diff are not
merged when the last difference between the two diff'd buffers is
resolved.
Normally, when two buffers are diff'd, folding is used to show only the
text that differs and to hide the text that is the same between the two
buffers. When a difference is resolved by making a block of text the
same in both buffers, the folds are updated to merge that block with the
folds above and below it into one closed fold.
That updating of the folds did not occur when the block of text was the
last diff block in the buffers.
The bug was introduced by this patch on August 24, 2019:
patch 8.1.1922: in diff mode global operations can be very slow
Problem: In diff mode global operations can be very slow.
Solution: Do not call diff_redraw() many times, call it once when
redrawing. And also don't update folds multiple times.
Unfortunately, folds were then not updated often enough.
The problem was fixed by adding a short loop to the ex_diffgetput()
function in diff.c to update all the folds in the current tab when the
last difference is removed.
A test for this was added to test_diffmode.vim. Two of the reference
screen dumps for another test in that file,
Test_diffget_diffput_linematch(), had to be changed to have all the
folds closed rather than to have the last diff block remain open.
closes: vim/vim#174573fa0d3514b
Co-authored-by: Gary Johnson <garyjohn@spocom.com>