summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/lua/ui_event_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-03-13fix(normal): crash using :norm from vim.ui_attach shell message event #38283luukvbaal1
Problem: 'showcmd' buffer is being populated for :norm commands, which can result in a recursive uv_run() when called from a msg_show vim.ui_attach callback for a shell message. Solution: The 'showcmd' buffer is never displayed while executing a :normal command so prevent unnecessary work, avoiding the crash.
2026-03-08fix(api): merge split window config only on successSean Dewar1
Problem: nvim_win_set_config may merge configs despite failing to configure a split, and without applying necessary side-effects (like setting style=minimal options). Plus, autocommands may apply a different config after the merge, causing side-effects to apply for an outdated config. Solution: merge configs last, only on success. Include fields only relevant to splits. Properly set _cmdline_offset for splits. Maybe better to disallow _cmdline_offset for splits instead, as the pum is relative to cmdline_row anyway? (I didn't want to change behaviour too much) Also use expect_unchanged in an unrelated test to quash a warning.
2026-02-24fix(messages): unwanted ext_messages newlines for confirm() #38045luukvbaal1
Problem: Newlines emitted with ext_messages intended to position the message/prompt on the message grid. Solution: Don't emit these newlines with ext_messages, followup to 4260f73e.
2026-02-16fix(messages): message not flushed at end of command #37904luukvbaal1
Problem: Logic determining messages belonging to the last command to show with "g<" does not flush pending messages. This can result in clearing the temporary message history before a message still belonging to the previous command was emitted. Solution: Flush pending messages when marking the end of messages belonging to previous command.
2026-01-26fix(ui): only internal messages are unsafe #37462luukvbaal1
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.
2025-10-08vim-patch:9.1.1817: popup: there are some position logic bugs (#36075)zeertzjq1
Problem: popup: there are some position logic bugs Solution: Refactor position logic and fix a few bugs (Girish Palya). This change does the following: - Simplified and rewrote horizontal positioning logic (was overly complex). - Split horizontal and vertical positioning into separate functions. - Fixed missing truncation marker (e.g. `>`) when items were truncated and `pummaxwidth` was not set. - Fixed occasional extra space being added to menu items. - Update tests closes: vim/vim#18441 https://github.com/vim/vim/commit/e3ed5584ed7fad7070d49ddfba4f41bc2b22ca97 Cherry-pick pum_display_{rtl,ltr}_text() changes from patch 9.1.1835. Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-03fix(window): avoid referencing cmdline_win after it is closed #35617luukvbaal1
Solution: A window marked for ext_cmdline usage is still referenced after it is already closed and freed. Solution: Unset cmdline_win when the window is closed.
2025-07-09test(messages/cmdline_spec): convert highlight IDs to name and format (#34845)luukvbaal1
Problem: Hardcoded highlight IDs for ext_messages/cmdline output need to be adjusted everytime a builtin highlight group is added. Solution: Store a global map of default highlights through nvim_get_hl() and fetch missing (custom) highlight groups through synIDattr(). Use more compact formatting for screen:expect().
2025-07-08feat(messages): add "prev_cmd" argument to msg_history_show (#34779)luukvbaal1
Problem: Unable to tell whether msg_history_show event is emitted for a :messages or g< command. Solution: Add "prev_cmd" argument that is set to true for g<.
2025-06-26feat(ui): emit "msg_clear" event after clearing the screen (#34035)luukvbaal1
Problem: ext_messages cannot tell when the screen was cleared, which is needed to clear visible messages. An empty message is also never emitted, but clears messages from the message grid. Solution: Repurpose the "msg_clear" event to be emitted when the screen was cleared. Emit an empty message with the `empty` kind to hint to a UI to clear the cmdline area.
2025-06-25fix(ui)!: decouple ext_messages from message grid #27963luukvbaal1
Problem: ext_messages is implemented to mimic the message grid implementation w.r.t. scrolling messages, clearing scrolled messages, hit-enter-prompts and replacing a previous message. Meanwhile, an ext_messages UI may not be implemented in a way where these events are wanted. Moreover, correctness of these events even assuming a "scrolled message" implementation depends on fragile "currently visible messages" global state, which already isn't correct after a previous message was supposed to have been overwritten (because that should not only happen when `msg_scroll == false`). Solution: - No longer attempt to keep track of the currently visible messages: remove the `msg_ext(_history)_visible` variables. UIs may remove messages pre-emptively (timer based), or never show messages that don't fit a certain area in the first place. - No longer emit the `msg(_history)_clear` events to clear "scrolled" messages. This opens up the `msg_clear` event to be emitted when messages should actually be cleared (e.g. when the screen is cleared). May also be useful to emit before the first message in an event loop cycle as a hint to the UI that it is a new batch of messages (vim._extui currently schedules an event to determine that). - Set `replace_last` explicitly at the few callsites that want this to be set to true to replace an incomplete status message. - Don't store a "keep" message to be re-emitted.
2025-06-15fix(messages): add append parameter to history entries (#34467)luukvbaal1
Problem: The "append" parameter added in abb40ece is missing from history entries, resulting in different message formatting for "g<". Solution: Add "append" field to message history entries. Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
2025-05-24feat(ui): "append" parameter for "msg_show" UI eventsLuuk van Baal1
Problem: Consecutive "msg_show" events stemming from an `:echon` command are supposed to be appended without a newline, this information is not encoded in the "msg_show" event. Solution: Add an "append" parameter to the "msg_show" event that is set to true to indicate the message should not start on a new line. Considered alternative: Emit a newline for the common case instead at the start of a new message. That way UIs can more closely follow the logic as it is implemented for the message grid currently. This would be a breaking change. The "append" parameter seems OK.
2025-05-04feat(messages): cleanup Lua error messagesJustin M. Keyes1
"Error" in error messages is redundant. Just provide the context, don't say "Error ...".
2025-04-29feat(ui): use builtin completion popupmenu with ext_cmdline (#31269)luukvbaal1
Problem: UIs implementing ext_cmdline/message must also implement ext_popupmenu in order to get cmdline completion with wildoptions+=pum. Solution: Allow marking a window as the ext_cmdline window through nvim_open_win(), including prompt offset. Anchor the cmdline- completion popupmenu to this window.
2025-04-21feat(ui): avoid setting 'cmdheight' with vim.ui_attach()Luuk van Baal1
Problem: We allow setting 'cmdheight' to 0 with ext_messages enabled since b72931e7. Enabling ext_messages with vim.ui_attach() implicitly sets 'cmdheight' to 0 for BWC. When non-zero 'cmdheight' is wanted, this behavior make it unnecessarily hard to keep track of the user configured value. Solution: Add set_cmdheight to vim.ui_attach() opts table that can be set to false to avoid setting 'cmdheight' to 0.
2025-03-23test(log): use tempfile for expected error logs #33017luukvbaal1
2025-03-21fix(log): unify error messages for vim.ui_attach/decor providers #33005luukvbaal1
Problem: Error messages that cause a vim.ui_attach() namespace to detach are not visible in the message history. Decoration provider and vim.ui_attach error messages are dissimilar. Solution: Emit vim.ui_attach() errors as an actual message in addition to logging it. Adjust error message format.
2025-03-19fix(messages): incorrect error message splitting and kind #32990luukvbaal1
Problem: Message kind logic for emitting an error message is convoluted and still results in emitting an unfinished message earlier than wanted. Solution: Ensure emsg_multiline() always sets the kind wanted by the caller and doesn't isn't unset to logic for emitting the source message. Caller is responsible for making sure multiple message chunks are not emitted as multiple events by setting `msg_ext_skip_flush`...
2025-03-07feat(defaults): jump between :terminal shell prompts with ]]/[[ #32736Gregory Anders1
2025-01-29fix(ui): avoid redundant ext_cmdline events (#32237)luukvbaal1
Problem: `cmdline_show` is emitted unnecessarily each event loop iteration, because `cmdline_was_last_drawn` is never set. Solution: Keep track of whether the cmdline was last drawn to avoid unnecessarily emitting cmdline_show. Set `redraw_state` to emit `cmdline_pos` when emitting `CursorMovedC`. Only emit `cmdline_pos` when cmdline was last drawn.
2025-01-24fix(lua): pop retval for fast context LuaRefLuuk van Baal1
Problem: nlua_call_ref_ctx() does not pop the return value in fast context that did not error. Solution: Fall through to end; calling nlua_call_pop_retval().
2025-01-24fix(messages): avoid empty msg_showmode with 'noshowmode'Luuk van Baal1
2025-01-15fix(cmdline): prevent cmdline_show events after exiting cmdline #32033luukvbaal1
Problem: If a (vim.ui_attach) cmdline_hide callback triggers a redraw, it may cause cmdline_show events for an already exited cmdline. Solution: Avoid emitting cmdline_show event when ccline.cmdbuff is already NULL. Unset ccline.cmdbuff before emitting cmdline_hide.
2025-01-04test: use spawn_wait() instead of system() #31852Justin M. Keyes1
Problem: Tests that need to check `nvim` CLI behavior (no RPC session) create their own ad-hoc `system()` wrappers. Solution: - Use `n.spawn_wait` instead of `system()`. - Bonus: this also improves the tests by explicitly checking for `stdout` or `stderr`. And if a signal is raised, `ProcStream.status` will reflect it.
2025-01-02feat(ui)!: emit prompt "messages" as cmdline events #31525luukvbaal1
Problem: Prompts are emitted as messages events, where cmdline events are more appropriate. The user input is also emitted as message events in fast context, so cannot be displayed with vim.ui_attach(). Solution: Prompt for user input through cmdline prompts.
2024-12-23feat(ui): specify whether msg_show event is added to historyLuuk van Baal1
Pass along whether message in msg_show event is added to the internal :messages history.
2024-12-22feat(ui): additional arguments for cmdline_show/hide eventsLuuk van Baal1
Problem: Unable to tell what highlight the prompt part of a cmdline_show event should have, and whether cmdline_hide was emitted after aborting. Solution: Add additional arguments hl_id to cmdline_show, and abort to cmdline_hide.
2024-12-17feat(terminal)!: cursor shape and blink (#31562)Gregory Anders1
When a terminal application running inside the terminal emulator sets the cursor shape or blink status of the cursor, update the cursor in the parent terminal to match. This removes the "virtual cursor" that has been in use by the terminal emulator since the beginning. The original rationale for using the virtual cursor was to avoid having to support additional UI methods to change the cursor color for other (non-TUI) UIs, instead relying on the TermCursor and TermCursorNC highlight groups. The TermCursor highlight group is now used in the default 'guicursor' value, which has a new entry for Terminal mode. However, the TermCursorNC highlight group is no longer supported: since terminal windows now use the real cursor, when the window is not focused there is no cursor displayed in the window at all, so there is nothing to highlight. Users can still use the StatusLineTermNC highlight group to differentiate non-focused terminal windows. BREAKING CHANGE: The TermCursorNC highlight group is no longer supported.
2024-11-20fix(messages): more ext_messages kinds #31279luukvbaal1
Add kinds for various commands that output a list, the 'wildmode' list, and for number prompts.
2024-11-17fix(messages): proper multiline Lua print() messages #31205luukvbaal1
Problem: Separate message emitted for each newline present in Lua print() arguments. Solution: Make msg_multiline() handle NUL bytes. Refactor print() to use msg_multiline(). Refactor vim.print() to use print().
2024-11-16test(lua/ui_event_spec): avoid polluting log file (#31229)zeertzjq1
2024-11-15fix(ui): no fast context for prompt message kinds #31224luukvbaal1
Problem: No longer able to show prompt messages with vim.ui_attach(). Solution: Do not execute callback in fast context for prompt message kinds. These events must be safe to show the incoming message so the event itself serves to indicate that the message should be shown immediately.
2024-11-14fix(messages)!: vim.ui_attach message callbacks are unsafeLuuk van Baal1
Problem: Lua callbacks for "msg_show" events with vim.ui_attach() are executed when it is not safe. Solution: Disallow non-fast API calls for "msg_show" event callbacks. Automatically detach callback after excessive errors. Make sure fast APIs do not modify Nvim state.
2024-11-14fix(tests): needing two calls to setup a screen is cringebfredl1
Before calling "attach" a screen object is just a dummy container for (row, col) values whose purpose is to be sent as part of the "attach" function call anyway. Just create the screen in an attached state directly. Keep the complete (row, col, options) config together. It is still completely valid to later detach and re-attach as needed, including to another session.
2024-11-09feat(ext_messages): add hl_id to ext_messages chunksLuuk van Baal1
Problem: Ext_messages chunks only contain the highlight attr id, which is not very useful for vim.ui_attach() consumers. Solotion: Add highlight group id to message chunks, which can easily be used to highlight text in the TUI through nvim_buf_set_extmark(): hl_group = synIDattr(id, "name").
2024-05-28fix(ui): flush ext_cmdline events before doing cmdpreview #27950luukvbaal1
Problem: Unable to update the screen for external cmdline during cmdpreview. Solution: Flush the cmdline UI before cmdpreview state.
2024-05-01fix(ui): avoid recursiveness and invalid memory access #28578luukvbaal1
Problem: Calling :redraw from vim.ui_attach() callback results in recursive cmdline/message events. Solution: Avoid recursiveness where possible and replace global "call_buf" with separate, temporary buffers for each event so that when a Lua callback for one event fires another event, that does not result in invalid memory access.
2024-04-28fix(ui): activating all ext capabilities without remote UI #28555luukvbaal1
2024-04-27fix(ui): set 'cmdheight' to zero for all open tabpagesLuuk van Baal1
Problem: Enabling ext_messages claims to set 'cmdheight' to zero, but only does so for the current tabpage. Solution: Set stored 'cmdheight' value to zero for all tabpages.
2024-04-26fix(ui): update ext_ui widgets when attaching non-remote UILuuk van Baal1
Problem: Updating internalized UI capabilities is postponed until a remote UI attaches. Solution: Always update active UI widgets in ui_refresh().
2024-04-23test: improve test conventionsdundargoc1
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
2024-04-10refactor(test): inject after_each differentlyLewis Russell1
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.
2024-04-06fix: adjust error message for error in UI event callback (#28200)zeertzjq1
Also close Nvim instance before removing log file, otherwise the Nvim instance will still write to the log file. Also adjust log level in libuv_process_spawn(). Ref #27660
2024-01-12test: rename (meths, funcs) -> (api, fn)Lewis Russell1
2024-01-12test: use vim.inspect directlyLewis Russell1
2024-01-03refactor: format test/*Justin M. Keyes1
2023-12-09test: avoid repeated screen lines in expected stateszeertzjq1
This is the command invoked repeatedly to make the changes: :%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
2023-12-08test: use termopen() instead of :terminal more (#26462)zeertzjq1