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: Exmode is missing cmdline_block events.
Solution: Emit cmdline_block_show/append when executing a cmdline during
exmode. Emit cmdline_block_hide when leaving exmode.
Problem: "first" parameter added in 912388f5 for grouping printed lines
in a single event is ineffective for the :global command.
Solution: Only set the message kind for the first printed line during a
:global command.
Problem: UI2 does not implement the msg_show event msg_id parameter.
Solution: Store message IDs currently shown in the cmd/msg buffers.
Set extmarks spanning the message which are used to replace
a still visible message when a new message with the same ID
is received.
Problem:
There is no indication of when cursor is "behind" an unfocused, floating window.
Solution:
Set underline cursor to indicate when an unfocused floatwin is over the active cursor.
Problem: The wildmenu is hidden behind the dialog window with "list" in 'wildmode'.
Global ('laststatus' set to 3) statusline is hidden behind the
pager window.
Solution: Check wildmenumode() to adjust the dialog position when necessary.
Ensure pager is positioned above the global statusline with 'laststus' set to 3.
Problem: Internal messages do not have an ID, which is unexpected and
undocumented.
Solution: Always assign a msg_id to msg_show events, simplifying
logic/expectations for UIs.
Problem: No empty msg_ruler event after leaving a window whose ruler
is not part of the statusline with 'rulerformat'.
Solution: Properly keep track of when a ruler event was emitted with
'rulerformat' to emit clear event.
Problem: Scheduled callbacks reference potentially outdated window
handles e.g. after switching tabpage.
Solution: Use ext.wins which stores the updated window handles.
Problem:
On Windows, writing to a pipe doesn't work if the pipe isn't connected
yet. This causes an RPC request to a session newly created by connect()
to hang, as it's waiting for a response to a request that never reaches
the server.
Solution:
Wait for uv.pipe_connect() callback to be called when using connect().
Problem: 'cursorline' and part of 'statusline' are missing after
:diffput to an empty buffer.
Solution: Make sure the cursor doesn't go beyond the last line after
:diffput (zeertzjq)
related: neovim/neovim#37621
closes: vim/vim#19281ce1e562fda
Problem:
The :intro fails to display in ui2 because wait_return(true) triggers a full
redraw. Furthermore statuslines are visible when using :intro
Solution:
Replace wait_return() with plain_vgetc(). This works with old and ui2 while also removing the unnecessary statusline and "press ENTER" prompt.
Updates tests to work with new behaviour.
Signed-off-by: ashab-k <ashabkhan2000@gmail.com>
Problem: There are still ways to run into textlock errors with
vim.ui_attach callbacks trying to display a UI event.
Solution: Disregard textlock again during vim.ui_attach() callbacks
(also when scheduled). Partially revert 3277dc3b; avoiding
to flush while textlock is set is still helpful.
Problem: Fast context for msg_show event inhibits vim.ui_attach from
displaying a stream of messages from a single command.
Solution: Remove fast context from msg_show events emitted as a result
of explicit API/command calls. The fast context was originally
introduced to prevent issues with internal messages.
Problem: Multiple eol_right_align virtual texts with different widths
are incorrectly positioned. The lookahead loop uses `item` instead of
`lookaheadItem` when checking kind and accessing data, causing all
items to use the first item's width.
Solution: Use `lookaheadItem->kind` and `lookaheadItem->data.vt`
instead of `item->kind` and `item->data.vt` in the lookahead loop.
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: 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:
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.
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: Use-after-free in winframe_remove() (henices)
Solution: Set window_layout_locked() inside winframe_remove()
and check that writing diff files is disallowed when the
window layout is locked.
It can happen with a custom diff expression when removing a window:
1. Buffer was removed, so win_frame_remove() is called to remove the
window.
2. win_frame_remove() → frame_new_height() → scroll_to_fraction()
→ diff_check_fill() (checks for filler lines)
3. diff_check_fill() ends up causing a diff_try_update, and because we
are not using internal diff, it has to first write the file to a
buffer using buf_write()
4. buf_write() is called for a buffer that is not contained within a
window, so it first calls aucmd_prepbuf() to create a new temporary
window before writing the buffer and then later calls
aucmd_restbuf(), which restores the previous window layout, calling
winframe_remove() again, which will free the window/frame structure,
eventually freeing stuff that will still be accessed at step 2.
closes: vim/vim#19064ead1dda74a
Nvim doesn't have this bug as Nvim uses a floating window as autocommand
window, and removing it doesn't need winframe_remove().
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: info/preview floating windows are created
without wrap enabled, causing info text to be
truncated.
Solution: enable 'wrap' and set 'scrolloff' to 0 by
default, like vim's popup_create does.
Problem: Setting pumborder=shadow doesn't blend proerly.
Solution: Check fconfig.shadow when setting pum_grid.blending, like what
is done in check_blending().
Problem: Crash when closing a split window if autocmds close other
split windows but there are still floating windows.
Solution: Bail out and give the window back its buffer.
Problem: null pointer member access when closing the only non-float in the
current tab page if autocommands after closing all floats also close all other
tab pages. (making it the last window)
Solution: check last_window again after closing the floats.
Also reduce the scope of "wp"; it would be bugprone to use it before it's later
reassigned to the rv of win_free_mem if freed by Buf/WinLeave.
Problem:
We want to encourage implementing core features in Lua instead of C, but
it's clumsy because:
- Core Lua code (built into `nvim` so it is available even if VIMRUNTIME
is missing/invalid) requires manually updating CMakeLists.txt, or
stuffing it into `_editor.lua`.
- Core Lua modules are not organized similar to C modules, `_editor.lua`
is getting too big.
Solution:
- Introduce `_core/` where core Lua code can live. All Lua modules added
there will automatically be included as bytecode in the `nvim` binary.
- Move these core modules into `_core/*`:
```
_defaults.lua
_editor.lua
_options.lua
_system.lua
shared.lua
```
TODO:
- Move `_extui/ => _core/ui2/`
fix(pum): hide info window when insufficient space
Problem:
1. Info window was displayed even with insufficient space.
2. Tab characters counted as single cells.
Solution:
1. Hide window when space < 10 columns. Will be configurable
via completepopup width option in the future.
2. Use win_linetabsize over mb_string2cells.
Problem:
When the popupmenu has no border but includes a scrollbar, the info window
column is misaligned due to a missing column offset.
Solution:
Apply a one-column offset to the info window when the popup menu has no border
and a scrollbar is present.
Background:
Suppose a window has concealed lines, and sets conceallevel>2,
concealcursor="". The concealed lines are displayed if the window is
curwin and the cursor is on the those lines.
Problem:
line('w$', win) switches curwin to win, and then does validate_botline
for curwin. It computes botline assuming the concealed lines displayed,
resulting in a smaller value than the actual botline that the user sees.
Solution:
Evaluate line('w$', win) without switching curwin.
Apply similar changes to other functions that switches curwin.
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Problem:
CursorLine background check used global `normal_bg`, ignoring 'winhighlight'.
Solution:
Use `bg_attr` to get window-local Normal background instead.
Problem:
:messages history include the "search hit BOTTOM, continuing at TOP" message,
which is noise.
Solution:
Set msg_hist_off before giving the warning and reset it after warning.
Problem: feed_command, nvim_buf_set_option, nvim_buf_get_number, and exc_exec
are marked as deprecated.
Solution: Remove them from the test units in api/buffer_spec, autocmd/focus_spec,
ui/input_spec, and editor/put_spec.
Some test units only used a few deprecated functions, so creating a separate PR
for each would be excessive. Therefore, several were combined into a single PR.
Problem:
When the terminal shrinks, Neovim tries to recompute the layout and
adjust every window so that the total width matches the new Columns. But
in the scenario of numerous windows split horizontally, there is
not enough space for all of them. The frame width (topframe->fr_width) never
reaches the new Columns value, the logic tries to redistribute this negative
space across child frames, but it triggers the assert.
Solution:
Skip this case in `win_update`.
Problem: CursorLine doesn't consistently highlight text using groups
linked to Normal (e.g., in quickfix, passwd files), while it works
for direct Normal usage.
Solution: Don't let normal background from linked groups override
explicit non-normal backgrounds during attribute combination.
Problem:
The `over_flow` parameter in `grid_draw_bordertext` always added 1 for
the '<' character. As a result, titles that fit exactly were still
truncated with an unnecessary '<'.
Solution:
Adjust `over_flow` only when the actual overflow is greater than 0.
Fix#36872
Problem:
We truncate the title from start, this is somewhat inconsistent
with the way vim works. Usually we use < to truncate and keep
more trailing characters.
Solution:
Keep more trailing characters.