aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/ui_event_spec.lua
Commit message (Collapse)AuthorAge
* fix(ui): avoid redundant ext_cmdline events (#32237)luukvbaal2025-01-29
| | | | | | | | 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.
* fix(lua): pop retval for fast context LuaRefLuuk van Baal2025-01-24
| | | | | | 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().
* fix(messages): avoid empty msg_showmode with 'noshowmode'Luuk van Baal2025-01-24
|
* fix(cmdline): prevent cmdline_show events after exiting cmdline #32033luukvbaal2025-01-15
| | | | | | 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.
* test: use spawn_wait() instead of system() #31852Justin M. Keyes2025-01-04
| | | | | | | | | | | 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.
* feat(ui)!: emit prompt "messages" as cmdline events #31525luukvbaal2025-01-02
| | | | | | | 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.
* feat(ui): specify whether msg_show event is added to historyLuuk van Baal2024-12-23
| | | | | Pass along whether message in msg_show event is added to the internal :messages history.
* feat(ui): additional arguments for cmdline_show/hide eventsLuuk van Baal2024-12-22
| | | | | | | | 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.
* feat(terminal)!: cursor shape and blink (#31562)Gregory Anders2024-12-17
| | | | | | | | | | | | | | | | | | | | | 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.
* fix(messages): more ext_messages kinds #31279luukvbaal2024-11-20
| | | | Add kinds for various commands that output a list, the 'wildmode' list, and for number prompts.
* fix(messages): proper multiline Lua print() messages #31205luukvbaal2024-11-17
| | | | | | 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().
* test(lua/ui_event_spec): avoid polluting log file (#31229)zeertzjq2024-11-16
|
* fix(ui): no fast context for prompt message kinds #31224luukvbaal2024-11-15
| | | | | | | 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.
* fix(messages)!: vim.ui_attach message callbacks are unsafeLuuk van Baal2024-11-14
| | | | | | | | 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.
* fix(tests): needing two calls to setup a screen is cringebfredl2024-11-14
| | | | | | | | | | 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.
* feat(ext_messages): add hl_id to ext_messages chunksLuuk van Baal2024-11-09
| | | | | | | | 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").
* fix(ui): flush ext_cmdline events before doing cmdpreview #27950luukvbaal2024-05-28
| | | | Problem: Unable to update the screen for external cmdline during cmdpreview. Solution: Flush the cmdline UI before cmdpreview state.
* fix(ui): avoid recursiveness and invalid memory access #28578luukvbaal2024-05-01
| | | | | | | | 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.
* fix(ui): activating all ext capabilities without remote UI #28555luukvbaal2024-04-28
|
* fix(ui): set 'cmdheight' to zero for all open tabpagesLuuk van Baal2024-04-27
| | | | | | 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.
* fix(ui): update ext_ui widgets when attaching non-remote UILuuk van Baal2024-04-26
| | | | | | Problem: Updating internalized UI capabilities is postponed until a remote UI attaches. Solution: Always update active UI widgets in ui_refresh().
* test: improve test conventionsdundargoc2024-04-23
| | | | | | | | | 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.
* refactor(test): inject after_each differentlyLewis Russell2024-04-10
|
* test: improve test conventionsdundargoc2024-04-08
| | | | Work on https://github.com/neovim/neovim/issues/27004.
* fix: adjust error message for error in UI event callback (#28200)zeertzjq2024-04-06
| | | | | | 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
* test: rename (meths, funcs) -> (api, fn)Lewis Russell2024-01-12
|
* test: use vim.inspect directlyLewis Russell2024-01-12
|
* refactor: format test/*Justin M. Keyes2024-01-03
|
* test: avoid repeated screen lines in expected stateszeertzjq2023-12-09
| | | | | | 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
* test: use termopen() instead of :terminal more (#26462)zeertzjq2023-12-08
|
* vim-patch:8.1.0822: peeking and flushing output slows down execution (#25629)zeertzjq2023-10-14
| | | | | | | Problem: Peeking and flushing output slows down execution. Solution: Do not update the mode message when global_busy is set. Do not flush when only peeking for a character. (Ken Takata) https://github.com/vim/vim/commit/cb574f415486adff645ce384979bfecf27f5be8c
* test: make expect_unchanged() less confusing (#22255)zeertzjq2023-02-15
| | | | | | | | Problem: The sleep before collecting the initial screen state is confusing and may lead to unexpected success if it comes after a blocking RPC call. Solution: Remove that sleep and add an "intermediate" argument.
* fix(ui-ext): correct message kind in history before vim.ui_attach()notomo2022-11-07
|
* fix(lua): free vim.ui_attach callback before lua close (#20205)notomo2022-09-16
|
* fix(lua): make ui_attach()/ui_detach() take effect immediately (#20037)zeertzjq2022-09-01
|
* feat(lua): vim.ui_attach to get ui events from luabfredl2022-08-31
Co-authored-by: Famiu Haque <famiuhaque@protonmail.com>