Problem: tests: test_edit still fails on CI
(after v9.1.1701)
Solution: Fix the skip condition
42acf736a3
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: tests: failure on CI with GUI and ASAN in test_edit.res
(Hirohito Higashi)
Solution: Disable the test for that specific situation in CI, close
swapfiles
fixes: vim/vim#180706c14c4625b
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Need more Vim script specific tests
Solution: Add more tests (Yegappan Lakshmanan).
closes: vim/vim#18118e810ba5a1f
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: potential buffer overrun in bufwrite.c
Solution: Use a temporary variable (John Marriott)
In my Windows 11 Pro 64-bit build MAXPATHL is 1024 and IOSIZE is 1025.
In my Archlinux Linux 64-bit build MAXPATHL is 4096 and IOSIZE is 1025.
In funuction buf_write():
There is a check (line 713) that makes sure the length of fname is less
than MAXPATHL. There is a call to STRCPY() (line 1208) which copies the
string at fname into IObuff (which has size IOSIZE). For Unix builds
fname is set to sfname which may or may not be shorter. However, if
sfname is NULL sfname is set to fname.
Therefore, in builds where MAXPATHL > IOSIZE (eg in my linux build), it
is theoretically possible for the STRCPY() call to exceed the bounds of
IObuff.
This PR addresses this by copying fname into a local variable that has
the same maximum size as fname.
In addition:
Given that the filename is unconditionally overwritten in the for loop,
only copy the directory portion of fname. Move variable i closer to
where it is used.
closes: vim/vim#18095a19b019b87
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem: CmdlineChanged not triggered by <Del>
Solution: Use STRCMP() instead of STRNCMP()
(Shougo Matsushita)
closes: vim/vim#18101540480697d
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Problem:
Nvim does not have a core concept for indicating "progress" of
long-running tasks. The LspProgress event is specific to LSP.
Solution:
- `nvim_echo` can emit `kind="progress"` messages.
- Emits a `Progress` event.
- Includes new fields (id, status, percent) in the `msg_show` ui-event.
- The UI is expected to overwrite any message having the same id.
- Messages have a globally unique ID.
- `nvim_echo` returns the message ID.
- `nvim_echo(… {id=…})` updates existing messages.
Example:
local grp = vim.api.nvim_create_augroup("Msg", {clear = true})
vim.api.nvim_create_autocmd('Progress', {
pattern={"term"},
group = grp,
callback = function(ev)
print(string.format('event fired: %s', vim.inspect(ev))..'\n')
end
})
-- require('vim._extui').enable({enable=true, msg={target='msg', timeout=1000}})
vim.api.nvim_echo({{'searching'}}, true, {kind='progress', percent=80, status='running', title="terminal(ripgrep)"})
local id = vim.api.nvim_echo({{'searching'}}, true, {kind='progress', status='running', percent=10, title="terminal(ripgrep)"})
vim.api.nvim_echo({}, true, {id = id, kind='progress', percent=20, status = 'running', title='find tests'})
vim.api.nvim_echo({}, true, {id = id, kind='progress', status='running', percent=70})
vim.api.nvim_echo({{'complete'}}, true, {id = id, kind='progress', status='success', percent=100, title="find tests"})
Followups:
- Integrate with 'statusline' by listening to the Progress autocmd event.
- Integrate progress ui-event with `vim._extui`.
Problem: various functions may return incorrect window numbers for unfocusable
or hidden windows.
Solution: fix the checks. Make sure current windows in non-current tabpages have
a window number.
Fixes#35453
Problem: TextChangedT fires depending on whether Nvim needs to update_screen
while in terminal mode. This makes little sense as redraws can be completely
unrelated to the terminal. Also, TextChanged could be fired from changes in
terminal mode after returning to normal mode.
Solution: trigger it when b:changedtick changes, like other such events. Happens
when invalid cells are refreshed, though is no longer affected by cursor
changes. Don't fire TextChanged from changes in terminal mode after leaving.
Unlike the other TextChanged* events, I've elected to not have it be influenced
by typeahead. Plus, unlike when leaving insert mode when no TextChangedI events
are defined, I don't trigger TextChanged when returning to normal mode from
changes in terminal mode (is that a Vim bug?)
Curiously, Vim's TextChangedT is different; it's tied to its terminal cursor
redraws, which triggers pretty eagerly (but is unaffected by unrelated redraws)
- usually *twice* when data is sent to the terminal (regardless of whether it
causes any visible changes, like incomplete escape codes; wasn't true for Nvim).
Not clear to me how this event was actually intended to work, but this seems to
make the most sense to me.
Problem: w_wrow/col calculation in terminal_check_cursor is wrong when the
terminal is smaller than the window. Common when there's a larger window open
with the same terminal, or just after a resize (as refresh_size is deferred).
Solution: don't calculate it; validate_cursor will correct it later if it's
out-of-date.
Note that the toplines set for the terminal (also before this PR) assume
'nowrap' (which is set by default for terminal windows), and that no weird stuff
like filler lines are around. That means, for example, it's possible for the
cursor to be moved off-screen if there's wrapped lines. If this happens, it's
likely update_topline will move the cursor back on screen via validate_cursor or
similar, but maybe this should be handled more elegantly in the future?
Problem: autocommands can cause various problems in terminal mode, which can
lead to crashes, for example.
Solution: fix found issues. Move some checks to terminal_check and guard against
autocommands messing with things. Trigger TermEnter/Leave after terminal mode
has changed/restored most state. Wipeout the correct buffer if TermLeave
switches buffers and fix a UAF if it or WinScrolled/Resized frees the terminal
prematurely.
These changes also allow us to remove the buffer restrictions on TextChangedT;
they were inadequate in stopping some issues, and WinScrolled/Resized was
lacking them anyway.
Problem: when creating a new tabpage with a terminal window, terminal size is
not updated if there is no statusline.
Solution: do not rely on last_status to implicitly call terminal_check_size as a
side effect of making room for a statusline; call it directly.
Problem: topline of a focused terminal window may not tail to terminal output if
events scroll the window.
Solution: set the topline in terminal_check_cursor.
Problem: missing redraws when restoring saved cursorline/column, plus missing
statusline and mode redraws when not updating the screen in terminal mode.
Solution: schedule the redraws in a similar manner to other modes and remove
some now unnecessary redrawing logic. Redraw if cursorline-related options
change from entering terminal mode. This fixes test failures in later commits.
WTF: TextChangedT triggers based on must_redraw, which is... fun...? Try to
preserve its behaviour as much as we can for now.
Problem: in terminal mode, adjust_topline moves curwin's cursor to the last row
so set_topline tails the non-scrollback area. This may result in the observed
cursor position remaining tailed in events within the focused terminal, rather
than reflecting the actual cursor position.
Solution: use the focused terminal's actual cursor position immediately, rather
than relying on the next terminal_check_cursor call in terminal_check to set it.
Note: Maybe also possible for terminal mode cursor position to be stale
(reporting the normal mode position) when switching buffers in events to another
terminal until the next terminal_check call? (or until refresh_terminal is
called for it) Maybe not worth fixing that, though.
Problem: Text properties crossing lines not handled correctly.
Solution: When joining lines merge text properties if possible.
(Axel Forsman, closesvim/vim#5839, closesvim/vim#5683)
87be9be1db
Port docs from patch v8.1.0688.
Rewrite docs for ml_replace_buf_len().
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: FEAT_TEXT_PROP is a confusing name.
Solution: Use FEAT_PROP_POPUP. (Naruhiko Nishino, closesvim/vim#5291)
05ad5ff0ab
textprop,popuwin remain N/A features.
getchar.c has the relevant code changes.
Port runtest.vim changes from patch v8.1.1561.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: When appending a line text property flags are not added.
Solution: Add text properties to a newly added line.
b56ac049ea
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: When deleting a line text property flags are not adjusted.
Solution: Adjust text property flags in preceding and following lines.
c1a9bc1a72
"textprop" feature remains N/A.
Porting to sync ml_delete_int() with Vim 8.2.0845 and later.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Cannot attach properties to text.
Solution: First part of adding text properties.
98aefe7c32
"textprop" feature remains N/A.
Porting for ml_replace_len().
Co-authored-by: Bram Moolenaar <Bram@vim.org>
bash 5.3 (released July 2025) added support for ${ cmd;} and
${|cmd;} style command substitution, which is similar (but not
identical) to ksh/mksh.
closes: vim/vim#18084e06d81fe67
Co-authored-by: Kevin Pulo <kevin.pulo@mongodb.com>
Problem: tests: no test for actually moving cursor when menu is not
open with 'autocompletedelay'.
Solution: Use <Up> first in the test. Also remove two unnecessary <Esc>s
in completion timeout test (zeertzjq).
closes: vim/vim#18097e8b99ff6d5