| Age | Commit message (Collapse) | Author | Files |
|
Problem:
In the default 'titlestring', if the containing directory is the CWD, it renders as "."
Solution:
Add `:p` to the titlestring.
|
|
Problem: Marks are not adjusted unloading a buffer that doesn't exist
on disk. E.g. extmarks are still valid (and will be beyond the
end of the buffer if the buffer is reloaded), even though the
text is lost.
Solution: Adjust marks for a cleared buffer when unloading a buffer that
doesn't exist on disk.
|
|
- `src/nvim/ex_cmds_defs.h`: use "U" instead of "u" per
`readability-uppercase-literal-suffix`
|
|
Problem: fileinfo not shown after :bd of last listed buffer
(memeplex)
Solution: Set need_fileinfo to true in empty_curbuf()
(Hirohito Higashi)
When deleting the last listed buffer with :bd, the new empty buffer's
file info (e.g. "[No Name]" --No lines in buffer--) was not displayed.
do_ecmd() only calls fileinfo() for existing buffers (oldbuf), not for
newly created empty buffers.
Set need_fileinfo in empty_curbuf() so the file info is displayed after
redraw.
fixes: vim/vim#548
closes: vim/vim#19802
https://github.com/vim/vim/commit/3d472d86753c451ce6914f70161ffc40ee37ea96
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
|
The NULL checks added in #35679 are no longer needed after #38473.
_____________________________________________________________________________________________
*** CID 645258: (REVERSE_INULL)
/src/nvim/buffer.c: 645 in close_buffer()
639 // Autocommands deleted the buffer.
640 emsg(_(e_auabort));
641 return false;
642 }
643 buf->b_locked--;
644 buf->b_locked_split--;
>>> CID 645258: (REVERSE_INULL)
>>> Null-checking "win" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
645 if (abort_if_last && win != NULL && one_window(win, NULL)) {
646 // Autocommands made this the only window.
647 emsg(_(e_auabort));
648 return false;
649 }
650 }
/src/nvim/buffer.c: 626 in close_buffer()
620 // Autocommands deleted the buffer.
621 emsg(_(e_auabort));
622 return false;
623 }
624 buf->b_locked--;
625 buf->b_locked_split--;
>>> CID 645258: (REVERSE_INULL)
>>> Null-checking "win" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
626 if (abort_if_last && win != NULL && one_window(win, NULL)) {
627 // Autocommands made this the only window.
628 emsg(_(e_auabort));
629 return false;
630 }
631
|
|
Problem: w_locked can be bypassed when recursively set if not restored
to its prior value.
Solution: Rather than save/restore everywhere, just make it a count,
like other locks (Sean Dewar)
Requires the previous commit, otherwise b_nwindows will be wrong in
tests, which causes a bunch of weird failures.
closes: vim/vim#19728
https://github.com/vim/vim/commit/7cb43f286e55853cf21b9d8870a430390c1cc8f1
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
|
|
Problem: close_buffer() callers incorrectly handle b_nwindows,
especially after nasty autocmds, allowing it to go
out-of-sync. May lead to buffers that can't be unloaded, or
buffers that are prematurely freed whilst displayed.
Solution: Modify close_buffer() and review its callers; let them
decrement b_nwindows if it didn't unload the buffer. Remove
some now unneeded workarounds like 8.2.2354, 9.1.0143,
9.1.0764, which didn't always work (Sean Dewar)
(endless yapping omitted)
related: vim/vim#19728
https://github.com/vim/vim/commit/bf21df1c7bc772e3a29961c961d0821584d50ee0
b_nwindows = 0 change for free_all_mem() was already ported.
Originally Nvim returned true when b_nwindows was decremented before the end was
reached (to better indicate the decrement). That's not needed anymore, so just
return true only at the end, like Vim. (retval isn't used anywhere now anyways)
Set textlock for dict watchers at the end of close_buffer() to prevent them from
switching windows, as that can leave a window with a NULL buffer. (possible
before this PR, but the new assert catches it; added a test)
Despite textlock, things still aren't ideal, as watchers may observe the buffer
as unloaded and hidden (b_nwindows was decremented), yet still in a window...
Likewise, for Nvim, wipe_qf_buffer()'s comment may not be entirely accurate;
autocmds are blocked, but on_detach callbacks (textlocked) and dict watchers may
still run. Might be problematic, but those aren't new issues.
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
|
|
Problem: if close_buffer() in set_curbuf() unloads curbuf, NULL pointer
accesses may occur from enter_buffer() calling
end_visual_mode(), as curbuf is already abandoned and possibly
unloaded. Also, selection registers may not contain the
selection with clipboard+=autoselect(plus).
Solution: Move close_buffer()'s end_visual_mode() call to buf_freeall(), after
any autocmds that may restart it, but just before freeing anything
(Sean Dewar)
related: vim/vim#19728
https://github.com/vim/vim/commit/a8fdfd4fcb92b9fcbed3ad0a6769cb6bad34d965
Maybe this should be considered partial? clipboard+=autoselect isn't
implemented. If it is, we may need to update these comments to mention
TextYankPost being possible, and unskip its test.
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
|
|
Problem:
Currently, we recommend always inserting text above prompt-line in
prompt-buffer. This can be done using the `:` mark. However, although
we recommend it this way it can sometimes get confusing how to do it
best.
Solution:
Provide an api to append text to prompt buffer. This is a common
use-case for things using prompt-buffer.
|
|
Problem:
- Small error in port of v9.1.0678, causing :ball to check w_locked for the
wrong window.
- After #27439, free_all_mem() may not wipe out buffers that were open in more
than one window before windows were freed.
Solution:
- Check win_locked() for wp in ex_buffer_all(), not curwin.
- Set b_nwindows to 0 in free_all_mem() before calling close_buffer().
Ref: https://github.com/neovim/neovim/pull/38473#issuecomment-4125117681
No need to block these fixes on that.
free_all_mem() change also looks like it fixed the existing "N lua references were
leaked!" warnings on the CI.
|
|
Problem: 'jumpoptions' "view" doesn't remember skipcol and may lead to
glitched display with 'smoothscroll'.
Solution: Save skipcol in the mark view. Also make sure skipcol doesn't
exceed line size.
|
|
|
|
#38138
Problem: 5943a81 skips saving window options in `buflist_altfpos` for
style=minimal windows, which also prevents the window from restoring its own
options when switching buffers.
Solution: revert the change. In `get_winopts`, don't restore options from the
`WinInfo` of style=minimal windows when reusing values for a different window.
In `win_free`, clear `wi_optset` for minimal windows.
|
|
Problem: closing a minimal float saves its style-imposed options into
buffer's wininfo, which get picked up by normal windows on :bnext.
Solution: don't save window options to wininfo for style=minimal windows.
|
|
Problem:
Currently, if prompt gets changed during user-input with
prompt_setprompt() it only gets reflected in next prompt. And that
behavior is not also consistent. If user re-enters insert mode then the
user input gets discarded and a new prompt gets created with the new
prompt.
Solution:
Handle prompt_setprompt eagerly. Update the prompt display, preserve user input.
|
|
Problem: if buf_free_all autocommands open a terminal, it will remain open after
the buffer is freed.
Solution: close terminals again later, this time while blocking autocommands.
Did consider terminal_open checking stuff like b_locked_split instead, but
that's set during BufHidden, etc., which doesn't mean the buffer's being wiped.
|
|
Problem: Newlines intended to write messages below the cmdline or to
mark the start of a new message on message grid are emitted
through ext_messages. This results in unnecessary newlines for
a UI that has decoupled its message area from the cmdline.
msg_col is set directly in some places which is not transmitted
to msg_show events.
Various missing message kind for list commands.
Trailing newlines on various list commands.
Solution: Only emit such newlines without ext_messages enabled.
Use msg_advance() instead of setting msg_col directly.
Assign them the "list_cmd" kind.
Ensure no trailing newline is printed.
|
|
Problem: :tab sbuffer may close old tabpage if BufLeave autocommand
splits window (after 9.1.0143).
Solution: Only close other windows if the buffer will be unloaded
(zeertzjq).
related: neovim/neovim#37749
closes: vim/vim#19352
https://github.com/vim/vim/commit/6da9f757c48ce87df381d726b165bed6fa301423
|
|
(#37433)
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. (closes vim/vim#5754)
https://github.com/vim/vim/commit/cee52204ca030ce7814844e4dab8b4ed897ba3cc
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#19194
https://github.com/vim/vim/commit/6c118afeaae756f3bbb9793e6b248517ad39a3aa
|
|
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#19186
https://github.com/vim/vim/commit/fa64f92f6ab8b8080bdba77155e7bb3530fa21f6
|
|
Removed code doesn't seem to do anything? Looks like a clobbered remnant from
when do_filetype_autocmd lived in did_set_string_option.
Doc comment for wipe_buffer doesn't decrement top_file_num since a2d25b7 (2016),
which presumably means the comment on marks doesn't apply either. (fmark_T::fnum
can't refer to the wrong buffer as numbers aren't reused here anymore)
|
|
Problem: A BufAdd autocommand may cause alist_add() to use freed
memory, this is caused by the w_locked variable unset too
early (henices)
Solution: in trigger_undo_ftplugin() only set w_locked to false, if it
was false when calling the function.
related: v9.1.0678
closes: vim/vim#19023
https://github.com/vim/vim/commit/9266a2a19790dd3485b1dd32b3e27ba1d93e33d0
Co-authored-by: Christian Brabandt <cb@256bit.org>
|
|
Problem: b:undo_ftplugin not executed when re-using buffer
(archy3)
Solution: explicitly execute b:undo_ftplugin in buflist_new() when
re-using the current buffer
fixes: vim/vim#17113
closes: vim/vim#17133
https://github.com/vim/vim/commit/baa8c90cc0d214e036a3a7980d5cf95cae88a68d
Cherry-pick test_filetype.vim changes from patch 9.1.1325.
Co-authored-by: Christian Brabandt <cb@256bit.org>
|
|
Use terminal_running() instead of channel_job_running().
|
|
Problem: :wqall! doesn't close a terminal buffer like :qall! does
(after 8.0.1525).
Solution: Check eap->forceit (zeertzjq).
Ref: https://github.com/vim/vim/issues/2654#issuecomment-366803932
related: vim/vim#2654
related: neovim/neovim#14061
closes: vim/vim#19129
https://github.com/vim/vim/commit/d8558fdf4f2758163218289637e82c3ae2d617ec
|
|
Problem: :bdelete/bunload/bwipeout may attempt to switch to a closing
buffer, which fails. (after 9.1.2058)
Solution: don't consider switching to closing buffers (Sean Dewar)
closes: vim/vim#19107
https://github.com/vim/vim/commit/63d53de72d94b53172070acb2b1c50489d1133bd
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
|
|
Problem: b_locked_split is not checked for :sbuffer, which allows
autocommands to leave windows open to freed buffers.
Solution: In do_buffer_ext, check just before possibly splitting, after
handling 'switchbuf'. Leave win_split to handle the check for
curbuf. (needed even if curbuf is not the target, as setting
the buffer after splitting may fail) (Sean Dewar)
closes: vim/vim#19096
https://github.com/vim/vim/commit/ac5c8ab6cc655f42f61f690058be8483fae71d4a
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
|
|
(#37268)
Problem: Division by zero in :file after failing to wipe buffer
(after 8.2.4631).
Solution: Still call buf_clear_file() when failing to wipe buffer
(zeertzjq).
closes: vim/vim#19088
https://github.com/vim/vim/commit/1aa5ca4ecbef76a4df3a228e115eae7cc939cc86
|
|
Problem: :edit and :enew may reuse a 1-line terminal buffer, causing
the new buffer to still be a terminal buffer.
Solution: Don't reuse a terminal buffer, as it's not reused when it has
more than 1 line.
After this change close_buffer() is the only place where buf_freeall()
can be called on a terminal buffer, so move the buf_close_terminal()
call into buf_freeall() to save some code. Furthermore, closing the
terminal in buf_freeall() is probably more correct anyway, as it is
"things allocated for a buffer that are related to the file".
Also, remove the useless check for on_detach callbacks deleting buffer.
Even if b_locked fails to prevent that, the crash will happen at the end
of buf_updates_unload() first. On the other hand, many other call sites
of buf_updates_unload() and other buffer_updates_* functions don't set
b_locked, which may be a problem as well...
|
|
Problem: Crash when deleting terminal buffer and TermClose switches
back to the terminal buffer.
Solution: Set b_locked_split.
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
|
|
Problem: Crash when deleting terminal buffer and TermClose deletes
other buffers.
Solution: Close the terminal after restoring b_nwindows.
|
|
Problem: printf format not checked for semsg().
Solution: Add GNUC attribute and fix reported problems. (Dominique Pelle,
closes vim/vim#3805)
https://github.com/vim/vim/commit/b5443cc46dd1485d6c785dd8c65a2c07bd5a17f3
Cherry-pick a change from patch 8.2.3830.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
|
|
Problem: Calling termopen() or nvim_open_term() on a buffer with an
existing terminal leads to two terminals writing to the same
buffer if the terminal job is still running, or memory leak
if the terminal job has exited.
Solution: Close the terminal if the terminal job has exited, otherwise
report an error. For nvim_open_term() also don't write a
closed terminal's buffer content to the PTY.
|
|
(#37136)
Problem: Exe stack length can be wrong without being detected.
Solution: Add a check when ABORT_ON_INTERNAL_ERROR is defined.
https://github.com/vim/vim/commit/e31ee86859528a7ffe00405645547d494e522fa8
vim-patch:8.2.3262: build failure when ABORT_ON_INTERNAL_ERROR is defined
Port patch 9.0.1454 for "make formatc".
Co-authored-by: Bram Moolenaar <Bram@vim.org>
|
|
Problem: 'fsync' option cannot be set per buffer
Solution: Make 'fsync' option global-local
(glepnir)
closes: vim/vim#19019
https://github.com/vim/vim/commit/4d5b30372663e8ea356b25fe94334558c6ae283f
Co-authored-by: glepnir <glephunter@gmail.com>
|
|
see also 9bbbeb60e355844780db0aef955e860d68ac0342
|
|
Problem:
Tests that trigger `os_delay` messages may take 1-3 seconds, wasting
build/CI time, since this serves no purpose in tests.
Solution:
- Introduce `msg_delay` for cases where `os_delay` is being used as
a "UI feature".
- Skip `msg_delay` in tests.
|
|
Also add missing change to buflist_findfmark() from #19224.
|
|
save
Problem: Crash when buffer gets deleted inside charconvert during save
Solution: Check for `b_saving` inside `can_unload_buffer()`, so we don’t try to
unload a buffer while it’s still being saved (glepnir).
closes: vim/vim#18901
https://github.com/vim/vim/commit/fe1c57cd2caa7de2ce23557646d6c62a9a1b4f92
Co-authored-by: glepnir <glephunter@gmail.com>
|
|
Group up to 15 vimpatch numbers in 1 line to guard against
'make formatc'.
1-liner for vim_versions, num_patches.
Automate '*Version' to remove version.h macros.
'-V1 -v' lists merged Vim versions.
|
|
|
|
|
|
Problem: completion: complete_match() Vim script function and
'isexpand' option are not that useful and confusing
(after v9.1.1341)
Solution: Remove function and option and clean up code and documentation
(Girish Palya).
complete_match() and 'isexpand' add no real functionality to Vim. They
duplicate what `strridx()` already does, yet pretend to be part of the
completion system. They have nothing to do with the completion mechanism.
* `f_complete_match()` in `insexpand.c` does not call any completion code.
It’s just a `STRNCMP()` wrapper with fluff logic.
* `'isexpand'` exists only as a proxy argument to that function.
It does nothing on its own and amounts to misuse of a new option.
The following Vim script function can be used to implement the same
functionality:
```vim
func CompleteMatch(triggers, sep=',')
let line = getline('.')->strpart(0, col('.') - 1)
let result = []
for trig in split(a:triggers, a:sep)
let idx = strridx(line, trig)
if l:idx >= 0
call add(result, [idx + 1, trig])
endif
endfor
return result
endfunc
```
related: vim/vim#16716
fixes: vim/vim#18563
closes: vim/vim#18790
https://github.com/vim/vim/commit/cbcbff871224115c45bbd14582749a487c6fad30
Co-authored-by: Girish Palya <girishji@gmail.com>
|
|
Problem: %P in 'statusline' doesn't behave as documented
(after 9.1.1479).
Solution: Make the percentage 3-chars wide when not translated.
(zeertzjq)
fixes: vim/vim#18669
closes: vim/vim#18671
https://github.com/vim/vim/commit/73a0de4a04b48ccaa0291f91fb69606c66d7cf8c
Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
|
|
Problem: regression when displaying localized percentage position
(after v9.1.1291)
Solution: calculate percentage first (Emir SARI)
Cleanups made in ec032de broke the Turkish percent display, failing to
prepend it properly in cases between 0 and 10. In Turkish, the percent
sign is prepended to the number, so it was displaying it as `% 5`
(should have been `%5`), while displaying numbers bigger than 9 properly.
related: vim/vim#17597
https://github.com/vim/vim/commit/8fe9e55a7d92870f5bbaa592e1f3617e9cda33c6
The test was unskipped in Vim in patch 9.1.1479 which added Turkish
translation for "%d%%". However, Nvim has had Turkish translation for
"%d%%" since 2023, so don't skip the test.
Co-authored-by: Emir SARI <emir_sari@icloud.com>
|
|
Problem: too many strlen() calls in buffer.c
Solution: refactor buffer.c and remove strlen() calls
(John Marriott)
closes: vim/vim#17063
https://github.com/vim/vim/commit/ec032de6465f159bd57c22d464e0f4815f3aefc7
Co-authored-by: John Marriott <basilisk@internode.on.net>
|
|
file (#35968)
Problem: Code for handling v: variables in generic eval file.
Solution: Move v: variables to evalvars.c. (Yegappan Lakshmanan,
closes vim/vim#4872)
https://github.com/vim/vim/commit/e5cdf153bcb348c68011b308c8988cea42d6ddeb
Remove direct reference to "vimvars" for following functions:
- assert_error()
- get_vim_var_nr()
- get_vim_var_list()
- get_vim_var_dict()
- get_vim_var_str()
- set_cmdarg()
- set_reg_var()
- set_vcount()
- set_vexception()
- set_vthrowpoint()
- set_vim_var_bool()
- set_vim_var_dict()
- set_vim_var_list()
- set_vim_var_nr()
- set_vim_var_special()
- set_vim_var_string()
- set_vim_var_type()
Reorder functions based on v8.2.4930 for
eval_one_expr_in_str() and eval_all_expr_in_str().
Co-authored-by: Bram Moolenaar <Bram@vim.org>
|
|
(#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
https://github.com/vim/vim/commit/0208b3e80a080740ff77a5661d0f65090e317d90
Co-authored-by: Girish Palya <girishji@gmail.com>
|
|
Problem: nvim_win_set_config may crash when attempting to move curwin to a
different tabpage if there is no other non-float available to switch to.
Solution: fix the crash. Fix ONE_WINDOW checks in winframe_find_altwin and
win_altframe to consider floating windows by instead using one_window. Allow
one_window to consider non-current tabpages. We can use one_window in
win_close_othertab now to also better reflect its use in win_close.
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
|