Problem: Eagerly calling `showmode()` to update showmode where setting
`redraw_showmode` to be updated later would suffice.
Solution: Set `redraw_showmode` instead of calling `showmode()` if not
showing a busy message followed by a `ui_flush()`.
Problem: The swapfile attention message is not repeated after clearing
the screen.
After clearing the screen `msg_scrolled` is reset without
clearing other related variables, causing an assert.
Solution: Make the attention message part of the confirm prompt.
Call `msg_reset_scroll()`.
Problem: vim.ui_attach cmdline events emitted with an ephemeral cursor
position that is only used as the start of the search.
Solution: Delay setting the cursor position until after ui_flush().
Problem: Uninitialized grid for a "win" relative float when redrawing
just after it has been opened.
Solution: Ensure window grid is allocated or assigned the default grid.
Before this commit, I had trouble finding information about configuring
the insert mode completion. In particular, it was not clear that the
'wildopt' config that I already had in my vimrc does not apply here.
Also, `insert.txt` barely mentioned 'completeopt' except when
describing popups (I was more interested in bash-like behavior
where the unique prefix of all completions is completed first).
I'm hoping these edits will make the relevant docs easier to find.
closes: vim/vim#17515053aee01f7
Co-authored-by: Ilya Grigoriev <ilyagr@users.noreply.github.com>
Problem: When ignore_buf skips buffers during initialization,
shada_read_when_writing uses entry.data.filemark.fname directly
as map key, but later frees the entry, leaving dangling pointers.
Solution: Always create independent copies of filenames as map keys
using xstrdup() for new items, and free all keys during cleanup.
Fix#34440
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: 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
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: 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>
Problem: MS-Windows: internal compile error in uc_list() with VS 17.14
(ibear)
Solution: refactor code slightly (Mike Williams)
fixes: vim/vim#17402closes: vim/vim#174640174d8f386
Co-authored-by: Mike Williams <mrmrdubya@gmail.com>
Problem: If user init creates a floating window, startup windows
(e.g. to accomodate arglist files) are no longer created.
Solution: Check that firstwin->w_next is not floating when deciding
whether to make startup windows.
Problem: "msg_history_show" event is emitted when `msg_silent > 0`.
E.g. when capturing its output with `execute()`, which also
doesn't work with ext_messages.
Solution: Don't emit the "msg_history_show" event when `msg_silent > 0`.
Call regular messaging functions when `redirecting()`, to
execute `redir_write()` while ensuring the message itself
is not emitted.
Problem:
TSNode contains a `const TSTree*` and a `const void *id`. The `id`
points to Tree-sitter's internal type `Subtree`, which resides inside
the `TSTree` but may be deallocated if the `TSTree` is mutated (which
is likely why it is `const`).
The Lua method `TSTree:edit()` mutates the tree, which can deallocate
`id`.
See #25254 and #31758.
Solution:
To avoid this, we now make a copy of the tree before pushing its root to
the Lua stack. This also removes the fenv from TSLuaTree, as it was only
used when pushing the tree root to the Lua stack.
We also copy the tree in `node_tree`.
`ts_tree_copy()` just increments a couple of reference counters, so it's
relatively cheap to call.
fix(api): ensure win_get_config() is reciprocal
Problem: win_get_config() does not include a 'none' border field,
causing nvim_open_win() to apply the 'winborder' value.
Solution: Include a 'none' border field in the returned config,
such that it can be used reciprocally in nvim_open_win()
to yield the same window layout.
Problem: completion: various flaws in fuzzy completion
Solution: fix the issues (Girish Palya)
- Remove the brittle `qsort()` on `compl_match_array`.
- Add a stable, non-recursive `mergesort` for the internal doubly
linked list of matches.
- The sort now happens directly on the internal representation (`compl_T`),
preserving sync with external structures and making sorting stable.
- Update fuzzy match logic to enforce `max_matches` limits after
sorting.
- Remove `trim_compl_match_array()`, which is no longer necessary.
- Fixe test failures by correctly setting `selected` index and
maintaining match consistency.
- Introduce `mergesort_list()` in `misc2.c`, which operates generically
over doubly linked lists.
- Remove `pum_score` and `pum_idx` variables
fixes: vim/vim#17387closes: vim/vim#174308cd42a58b4
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: Unnecessary :if in session where both branches have the same
effect (after 9.1.1431).
Solution: Remove the superfluous :if (zeertzjq).
closes: vim/vim#174488f751d56f4
Problem: Hit-Enter Prompt when loading session files
Solution: use set+= for 'shortmess' to keep the existing flags
(Miguel Barro)
closes: vim/vim#174450ca5966196
Co-authored-by: Miguel Barro <miguel.barro@live.com>
Problem: Listing submenus with :menu doesn't work.
Solution: Don't go to the parent of the return value of find_menu(), and
handle empty path at the caller.
Related #8194, which actually only fixed the problem for menu_get(), not
for :menu Ex command.
Problem: Two separate window messages are used to get
the original console icon and set a new
one on windows, although the `WM_SETICON`
message returns the original icon itself.
Solution: Replace the two `WM_GETICON` messages with
two `WM_SETICON` messages, save the return
values and remove the call to `os_icon_set`.
Also, replace `os_icon_set` with `os_icon_reset`
as its only usage is now resetting the
icon to the original one.