fix(api): auto-load buffers in nvim_buf_set_* operations
Problem: Setting marks, lines, or text on unloaded buffers fails because
ml_line_count is not accurate until the buffer is loaded.
Solution: Add require_loaded_buffer() helper and use it in write operations
(nvim_buf_set_lines, nvim_buf_set_text, nvim_buf_set_mark). These now
auto-load buffers as needed.
Problem: has("terminfo") test fails on local runs because it expects
"HAVE_UNIBILIUM " in the :version info to mean that nvim was built
without unibilium.
Solution: Assume nvim is built with unibilium if HAVE_UNIBILIUM is
present in the version string and is NOT followed by 0, false, or off.
This isn't affecting CI runs because when the test detects that it is
running in CI it doesn't use the :version string at all.
Resolves https://github.com/neovim/neovim/issues/37456
* test(core/channels_spec): fix flaky test
Always use expect_stdout() to check PTY output.
* test(autocmd/termxx_spec): fix flaky test
Usually the Ctrl-C cancels the following :qa!, but sometimes it doesn't,
and Nvim exits before feed() returns. Instead make sure that :qa! always
reaches Nvim and use expect_exit().
Problem:
Crashed Nvim leaves socket files. Subsequent starts fail with "address already in use".
Solution:
On bind failure, test socket liveness via connect(). Remove if stale, retry bind().
Fixes#36581
Problem:
With shadow border, scrollbar and border overlap. Shadow's right border
starts from the second row (offset by 1), but scrollbar renders on every
row including the first. If they share a column, the first row shows
scrollbar where shadow hasn't started yet, causing misalignment.
Solution:
Separate scrollbar from the shadow's right border.
Problem: When using netrw to navigate directories, vim immediately
creates, then deletes a swap file in the entered directory,
causing the lastModifiedTime of that directory to change.
Solution: Use the :noswapfile command modifier in s:NetrwEditFile()
fixes: vim/vim#188544e2aafddbb
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Crash with 'wildmenu' when typing Ctrl-Y after Ctrl-A
(after 9.1.1714) (fizz-is-on-the-way).
Solution: Check if there are matches before applying one (zeertzjq).
closes: vim/vim#19210311b98d942
Problem: :wqall! doesn't quit when using :quit in BufWritePost
(after 8.0.1190).
Solution: Restore old value of "exiting" when calling not_exiting()
instead of always resetting it to FALSE (zeertzjq).
related: vim/vim#2205
closes: vim/vim#19212e803ad1c56
Problem: TabClosedPre may be triggered twice for the same tab page when
closing another tab page in BufWinLeave (after 9.1.1211).
Solution: Store whether TabClosedPre was triggered in tabpage_T
(zeertzjq).
Also fix the inconsistency that :tabclose! triggers TabClosedPre after
a failed :tabclose, but :close! doesn't even if there is only one window
in the tab page.
closes: vim/vim#192119168a04e0c
Problem: heap-use-after-free when wiping buffer in TabClosedPre.
Solution: Check window_layout_locked() when closing window(s) in another
tabpage (zeertzjq).
closes: vim/vim#191968fc7042b3d
Problem: tests: not checking error numbers properly.
Solution: Add a trailing comma to avoid matching a different error
number with the same prefix (zeertzjq)
closes: vim/vim#1715967fe77d272
Problem: TabClosedPre is triggered just before the tab is being freed,
which limited its functionality.
Solution: Trigger it a bit earlier and also on :tabclose and :tabonly
(Jim Zhou)
closes: vim/vim#16890bcf66e0141
Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com>
Synchronisation was lost in commit 0fab891 and the error propagated to
the output file in commit 5606ca5.
closes: vim/vim#16889b55f0221cc
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: Some plugins have a problem with the error check for using
:command with -complete but without -nargs.
Solution: In legacy script only give a warning message.
cc7eb2aa7a
Align tests with Vim only.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: A message ending in an unprintable character may emit a
msg_show event with the "empty" kind. No empty message event
for echom "".
Solution: Adjust conditions for emitting "empty" msg_show events.
Problem: There is an unavailable "Sponsor/Register" item in the Help
menu.
Solution: The item name has been unified to "Sponsor".
The item names of tlmenu, which are only valid in terminal mode, were
not updated, so unnecessary items that were unavailable were displayed.
This item is also very confusing when creating menu translations.
In addition, the indentation of an item with the same name in the
regular menu has been corrected.
closes: vim/vim#19201658cc102f6
Co-authored-by: Muraoka Taro <koron.kaoriya@gmail.com>
Problem: Vim intro screen shows register message (after v9.1.1893)
Solution: Remove the register message, registering is no longer useful
and possible.
fixes: vim/vim#18933closes: vim/vim#18934
Signed-off-by:
ca12f62d0a
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem:
Creating an autocommand which executes `:bwipe` on the Syntax event
causes a heap-use-after-free.
Solution: set BF_SYN_SET flag before applying autocommands
Problem:
When text is too long, it overflows into the border. This happens because
grid_line_maxcol includes border columns, so grid_line_puts can write
there.
Solution:
Truncate string to available width when need_fcs_trunc is set.
When width1 and width2 are negative the assertion may fail. It seems
that adding a negative value to w_curswant won't cause any problems, so
just change the assertion.
Problem: nvim_parse_expression null pointer dereference with unmatched ]
followed by a node.
Solution: if ast_stack was empty, set new_top_node_p to top of the stack after
pushing the list literal node; similar to what's done for curlies.
This bug was originally found by a Matrix user, but I couldn't remember how to
trigger it... Ran into the other crash while finding a repro. :P
Problem: nvim_parse_expression null pointer dereference when parsing an
identifier followed by { with "highlight" parameter set to false.
Solution: only set opening_hl_idx if pstate->colors is not NULL.
Not added to parser_tests.lua as that uses highlight = true.
Problem: Crash with combination of terminal popup and autocmd.
Solution: Disallow closing a popup that is the current window. Add a check
that the current buffer is valid. (closesvim/vim#5754)
cee52204ca
Cherry-pick related changes from patch 9.0.1454.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Last buffer not freed with EXITFREE (after 9.1.2087).
Solution: Free the last buffer when inside free_all_mem()
(zeertzjq).
This isn't really a memory leak, as the last buffer's memory is still
reachable via pointers like firstbuf and lastbuf. But it's possible that
this may cause false ASAN warnings in the future, which is what EXITFREE
is supposed to prevent.
closes: vim/vim#191946c118afeaa
Problem: Crash when using :tabonly in BufUnload.
Solution: Set curbuf when setting curwin->w_buffer. Don't wipe out a
buffer if there are no other buffers. Don't decrement
b_nwindows if it was 0 before buf_freeall() (zeertzjq).
fixes: vim/vim#19088#issuecomment-3710172769
closes: vim/vim#19186fa64f92f6a
Problem: The health check for `curl` strips the first line of the
version output, which contains potentially useful information.
Solution: Only trim empty lines.
Problem: Error message for layout change does not match action.
Solution: Pass the command to where the error is given. (closesvim/vim#11573)
9fda81515b
Thinking about this again, it's actually OK to check split_disallowed in
window_layout_locked(), so add the check.
Also add missing window_layout_locked() in tabpage_close().
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Redundant NULL checks in find_pattern_in_path().
Solution: Remove the NULL checks. Also fix typos in test_diffmode.vim
(zeertzjq).
After assigning to inc_opt on line 2976, it's dereferenced immediately,
and not assigned another value afterwards, so checking for NULL after
line 2977 is redundant.
closes: vim/vim#19185ce394b13e9