1966 Commits

Author SHA1 Message Date
luukvbaal
4260f73e13 fix(messages): unwanted newlines with ext_messages #37733
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.
2026-02-08 09:47:02 -05:00
luukvbaal
a33e5fb1bb fix(ui): cmdline_block events for exmode #37751
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.
2026-02-06 08:10:33 -05:00
luukvbaal
e198037148 fix(ui2): always route to dialog when cmdline is open #37730
Problem:  Messages emitted while cmdline is open are not shown with
          cmdline message target.
Solution: Route to dialog window when cmdline is open.
2026-02-05 14:54:22 -05:00
luukvbaal
f1dcde6cba fix(messages): single msg_show event for :global command #37728
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.
2026-02-05 08:37:20 -05:00
luukvbaal
bf68ba40a0 refactor: rename _extui => _core.ui2 #37692
Problem:
_extui module name is confusing and should eventually end up in _core/.

Solution:
Move it there and name it ui2.
2026-02-05 07:45:45 -05:00
luukvbaal
72a557c61b fix(ui2): only copy highlight marks when expanding cmdline #37709
Problem:  Error copying over multi-line message span marks to expanded cmdline.
Solution: Only copy over the highlight marks as intended.
2026-02-04 19:23:22 -05:00
luukvbaal
db2a54996e feat(ui2): replace message by its ID #37672
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.
2026-02-04 14:11:35 -05:00
Sean Dewar
da7580498a test(float): cursor unobscured by hidden float and in cmdline 2026-02-04 18:55:21 +00:00
glepnir
a2b92a5efb feat(ui): show "empty" cursor behind unfocused floatwin #37624
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.
2026-02-04 10:09:50 -05:00
Sean Dewar
9655bd560f fix(ui2): don't adjust dialog pos for pum wildmenu (#37695)
Problem:  Dialog position unnecessarily adjusted for pum wildmenu.
Solution: Apply no offset if the pum is visible.
2026-02-04 13:15:34 +01:00
luukvbaal
3038f0191e fix(ui2): wildmenu hidden behind dialog window #37684
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.
2026-02-03 08:17:33 -05:00
luukvbaal
c85313bac7 fix(messages): always assign msg_id to msg_show events #37671
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.
2026-02-03 07:52:03 -05:00
zeertzjq
19eb75831b ci(test): bump Windows runners to windows-2025 and unskip tests (#37666)
Bumping to windows-2025 seems to fix at least one case of spaces having
wrong attributes in TUI tests, which allow unskipping dozens of tests.
2026-02-03 03:03:41 +08:00
luukvbaal
8aec33e322 fix(ui): clear msg_ruler event with 'rulerformat' #37675
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.
2026-02-02 11:08:10 -05:00
luukvbaal
8c7bbfba3d fix(ui2): callbacks reference stale message-window handles #37673
Problem:  Scheduled callbacks reference potentially outdated window
          handles e.g. after switching tabpage.
Solution: Use ext.wins which stores the updated window handles.
2026-02-02 10:54:26 -05:00
zeertzjq
77162a717a test: wait for uv.pipe_connect() callback (#37640)
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().
2026-02-01 08:14:12 +08:00
zeertzjq
7ca3a56258 fix(ui): don't crash if maximum UI count reached (#37636) 2026-01-31 21:09:06 +08:00
zeertzjq
1e6c4ea896 test: add reasons to some skipped tests (#37632) 2026-01-31 00:25:48 +00:00
zeertzjq
47ce93ad6d vim-patch:9.1.2118: 'cursorline' missing after :diffput to empty buf (#37628)
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#19281

ce1e562fda
2026-01-30 20:09:33 +08:00
luukvbaal
1a3d3b77bb fix(ui): no empty message for substitution match with ext_messages #37600
Problem:  Empty message is emitted when a match is found.
Solution: Don't emit it with ext_messages enabled.
2026-01-29 16:51:58 -05:00
ashab-k
027b7d6bbb fix(ui): :intro not displayed with ui2 #37472
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>
2026-01-27 18:25:36 -05:00
luukvbaal
1d57374c41 fix(ui): textlock still causes issues for UI callbacks #37513
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.
2026-01-27 09:30:37 -05:00
luukvbaal
d30d91f3a4 fix(ui): only internal messages are unsafe #37462
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.
2026-01-26 18:18:51 -05:00
luukvbaal
96e1acfa42 fix(messages): add "list_cmd" kind to :colorscheme #37561
Problem:  No kind for :colorscheme message.
Solution: Assign it the "list_cmd" kind.
2026-01-26 11:56:39 -05:00
zeertzjq
b3242af187 vim-patch:9.1.2102: foldtext not reversed and cut off in 'rightleft' mode
Problem:  foldtext not reversed and cut off in 'rightleft' mode
          (bfredl)
Solution: Fix the rightleft redrawing logic (Sergey Vlasov)

fixes:  vim/vim#2659
closes: vim/vim#19220

b51ac5e378

Co-authored-by: Sergey Vlasov <sergey@vlasov.me>
2026-01-24 06:55:54 +08:00
glepnir
589232c0e0 fix(extmark): wrong eol_right_align width calculation (#37034)
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.
2026-01-23 08:35:43 +00:00
zeertzjq
1883fe39bd test: fix some type warnings (#37483) 2026-01-21 15:11:47 +08:00
glepnir
0712a9c87b fix(pum): separate scrollbar from shadow border (#37448)
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.
2026-01-19 19:39:48 -08:00
luukvbaal
8bdfd286e5 fix(messages): adjust msg_show "empty" kind logic (#37427)
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.
2026-01-19 17:15:44 +01:00
glepnir
5a65321684 fix(pum): text overflows into border on truncation (#37438)
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.
2026-01-18 08:55:30 +00:00
zeertzjq
e51f5e17e1 vim-patch:9.0.0909: error message for layout change does not match action (#37436)
Problem:    Error message for layout change does not match action.
Solution:   Pass the command to where the error is given. (closes vim/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>
2026-01-17 10:58:26 +08:00
zeertzjq
40fb2818b6 vim-patch:9.1.2085: Use-after-free in winframe_remove()
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#19064

ead1dda74a

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>
2026-01-14 13:56:01 +08:00
glepnir
634f6424aa fix(completion): set 'wrap' and scrolloff=0 in preview window (#37327)
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.
2026-01-10 16:31:01 +08:00
zeertzjq
445cb751e6 fix(pum): pumborder=shadow not blending properly (#37328)
Problem:  Setting pumborder=shadow doesn't blend proerly.
Solution: Check fconfig.shadow when setting pum_grid.blending, like what
          is done in check_blending().
2026-01-09 11:52:59 +00:00
zeertzjq
df62cb3e69 fix(window): crash closing split if autocmds close other splits (#37233)
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.
2026-01-05 11:17:00 +08:00
Sean Dewar
c14de47f1a fix(window): crash closing only non-float if autocmds :tabonly (#37218)
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.
2026-01-04 13:15:08 +00:00
zeertzjq
acc3554439 vim-patch:9.1.2037: undo: cursor position not correctly restored (#37195)
Problem:  undo: cursor position not correctly restored
Solution: Do not override the saved cursor position (altermo)

closes: vim/vim#19052

a722da29c1

Co-authored-by: altermo <107814000+altermo@users.noreply.github.com>
2026-01-02 08:21:55 +08:00
Justin M. Keyes
20e77c5d88 build: ship "_core/*" as bytecode (built-into Nvim binary)
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/`
2025-12-30 01:44:24 -05:00
glepnir
922816877f fix(pum): hide info floating window when insufficient space (#37107)
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.
2025-12-27 13:56:34 +00:00
glepnir
ef0386fe9a fix(pum): adjust info window column offset when scrollbar is present (#37069)
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.
2025-12-26 02:15:55 +00:00
zeertzjq
c374d78095 test(ui/inccommand_spec): don't check for transient message (#37078)
The check for v:errmsg is enough.
2025-12-23 08:15:32 +08:00
Jaehwang Jung
033f1123cd fix(marks): wrong line('w$', win) with conceal_lines (#37047)
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>
2025-12-22 09:03:50 +00:00
Olivia Kinnear
ad330e99d1 fix(statusline): diagnostics spacing #36897 2025-12-20 23:58:38 -05:00
glepnir
6af8958055 fix(highlight): respect 'winhighlight' in CursorLine Normal check #36927
Problem:
CursorLine background check used global `normal_bg`, ignoring 'winhighlight'.

Solution:
Use `bg_attr` to get window-local Normal background instead.
2025-12-16 00:51:54 -05:00
Ayaan
53aad276b6 fix(messages): exclude "search hit BOTTOM" msg from history #36961
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.
2025-12-15 14:01:27 -05:00
glepnir
e265cc28f9 refactor(test): deprecates functions in some tests #36972
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.
2025-12-15 10:58:24 -05:00
CompileAndConquer
aeebc51851 fix(grid): assert crash during extreme resize layouts #36847
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`.
2025-12-10 00:32:51 -05:00
glepnir
625c59fe5f fix(highlight): Normal-linked groups shouldn't override CursorLine #35026
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.
2025-12-09 23:01:27 -05:00
skewb1k
3b6e8e484e fix(float): prevent truncation of title that fits exactly #36880
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
2025-12-09 13:37:32 -05:00
glepnir
cb171ee7cb fix(float): tail truncate long title #28387
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.
2025-12-08 01:52:07 -05:00