aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/ui_spec.lua
Commit message (Collapse)AuthorAge
* fix(rpc): redraw parse failure silently closes channel #42220Justin M. Keyes2026-10-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: When `unpacker_parse_redraw()` fails, it closes the unpacker without setting `unpack_error`, so `chan_close_on_err()` gets a NULL message. A pending request fails with an empty error (`RPC: (null)`). c04d0734a728 fixed the crash that followed (advancing the closed unpacker), but not the silent close itself. Repro: Self-attach (`nvim_ui_attach` on a loopback `sockconnect()` channel) closes the channel without a visible reason, either while `nvim_ui_attach` is pending or at the next redraw. Solution: Set an error msg when `unpacker_parse_redraw()` fails. Note: Self-attach fails for accidental reasons, not by design: - An incoming "redraw" notif is always parsed "as a UI client" (`handle_ui_client_redraw`), whose `grid_line` buffer is only allocated in a UI client process. A loopback channel is both ends, so it parses its own redraw stream as if it were the TUI. - Even if parsing worked, `parse_msgpack()` drops redraw events unless `ui_client_attached`, and a `sockconnect()` client has no notification callback.
* test(api): self-attach test #42219CompileAndConquer2026-10-03
|
* fix(rpc): don't advance closed unpacker on self-attachLorenzo Piombini2026-10-02
|
* feat(multicursor): MC HAMMER #41587Justin M. Keyes2026-09-01
| | | | | | | | | | | | | | | | | | | | | Other (squashed) commits: fix(tui): emit ui_send output atomically with the frame Problem: tui_ui_send() writes directly to the TTY, bypassing the output buffer. Sequences sent via nvim_ui_send() (e.g. kitty multiple-cursors, or visual-dot-repeat) always arrive in a separate TTY write from the frame they were computed for. This manifests as "tearing", or e.g. in the case of multicursor the terminal renders text with stale cursor overlays. Solution: - tui_ui_send(): while a frame is being assembled (pending invalid regions or buffered output), buffer instead of writing directly. - Out-of-frame sends (tty queries, clear-on-disable) still write immediately. - mcursor.lua: emit the terminal-cursor update at the end of the redraw cycle (`on_end`, when screen positions are final) instead of vim.schedule().
* test(harness): migrate away from magic globalsJustin M. Keyes2026-07-21
| | | | | | | | | | | | | | | | | | | | | Problem: The magic globals `it`, `describe`, etc., are more trouble than they are worth. - Hooking into `after_each` requires `getfenv()` hacks. - They confuse luals/emmylua, because the top-level `.luarc.json` isn't merged with `test/.luarc.json` (apparently a luals limitation?) - They totally defeat discoverability because the user just has to "know" about the various magic symbols. So they harm DX, which means they serve no purpose at all. Solution: - Expose the test API from `testutil`, so tests can call `t.it()`, `t.describe()`, etc., in the conventional way. - Drop `getfenv()` hacks. - Drop the `setfenv()` injection in `load_chunk`. - Drop `test/_meta.lua`.
* test(api/ui_spec): fix flaky test (#40767)zeertzjq2026-07-16
| | | | | | | | | | | | | | | The poke_eventloop() and screen:expect() sometimes don't run the test runner's event loop long enough for the data to arrive at the reading end of the pipe. Use a screen:expect_unchanged() so that the event loop can run a bit longer. FAILED ...ovim/build/Xtest_xdg_api/test/functional/api/ui_spec.lua @ 105: nvim_ui_send works with stdout_tty Expected values to be equal. Expected: "\27]11;?\7Hello world" Actual: "\27]11;?\7" stack traceback: ...ovim/build/Xtest_xdg_api/test/functional/api/ui_spec.lua:138: in function <...ovim/build/Xtest_xdg_api/test/functional/api/ui_spec.lua:105>
* fix(tui): attribute `TermResponse` to source channel #40330Barrett Ruth2026-06-23
| | | | | | | Problem: Attach-time terminal probes cannot distinguish responses from different attached UIs. Solution: Identify the UI by RPC channel id in `TermResponse` and make `vim.tty.request()` filter responses by channel.
* fix(defaults): detect `'background'`/`'termguicolors'` on UI attach #40175Barrett Ruth2026-06-20
| | | | | | | | Problem: Terminal background and truecolor detection runs only at startup, gated on a UI being attached. A headless server has no UI then, so `'background'` and `'termguicolors'` are never detected and remote UIs ignore the terminal's theme. Solution: Also (re)detect on UIEnter. The most recently attached terminal wins; an explicit user value is preserved.
* test: run Lua harness with nvim -lLewis Russell2026-05-13
| | | | | | | | | | | | | | | | | | Problem: The Lua test harness still ran through standalone -ll mode, so tests depended on the low-level Lua path instead of the regular Nvim Lua environment. That also meant os.exit() coverage had to carry an ASAN workaround because Lua's raw process exit skipped Nvim teardown and let LeakSanitizer interfere with the observed exit code. Solution: Run the harness and related fixtures with nvim -l. Patch os.exit() in the main Lua state to exit through getout(), so scripts observe normal Nvim shutdown while standalone -ll remains available for generator-style scripts. As a consequence, the startup test can assert os.exit() without disabling leak detection. AI-assisted: Codex
* fix(rpc): trigger UILeave earlier on channel close (#38846)zeertzjq2026-04-08
| | | | | | | | | | | | | Problem: On exit, rpc_free() is called when processing main_loop.events after libuv calls close callbacks of the channel's stream. However, when there are no child processes, these libuv callbacks are called in loop_close() instead of proc_teardown(), and main_loop.events isn't processed after loop_close(). As a result, calling remote_ui_disconnect() in rpc_free() causes UILeave to depend on the presence of child processes. Solution: Always call remote_ui_disconnect() in rpc_close_event(), and remove the call in rpc_free().
* fix(api): use standard error messagesJustin M. Keyes2026-03-16
|
* test: wait for uv.pipe_connect() callback (#37640)zeertzjq2026-02-01
| | | | | | | | | | 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().
* fix(ui): don't crash if maximum UI count reached (#37636)zeertzjq2026-01-31
|
* feat(tui): add nvim_ui_send (#35406)Gregory Anders2025-08-22
| | | | This function allows the Nvim core to write arbitrary data to a TTY connected to a UI's stdout.
* 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.
* 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.
* test: rename (meths, funcs) -> (api, fn)Lewis Russell2024-01-12
|
* test: typing for helpers.methsLewis Russell2024-01-12
|
* refactor: format test/*Justin M. Keyes2024-01-03
|
* docs: deprecate the "term_background" UI fieldGregory Anders2023-11-13
|
* fix(startup): trigger UIEnter for the correct channel (#25860)zeertzjq2023-11-01
|
* test: fix VimResume test flakiness (#24438)zeertzjq2023-07-23
|
* fix(events): trigger VimResume on next UI request (#24426)zeertzjq2023-07-23
|
* refactor(api): consistent VALIDATE messages #22262Justin M. Keyes2023-02-14
| | | | | | | | | | Problem: Validation messages are not consistently formatted. - Parameter names sometimes are NOT quoted. - Descriptive names (non-parameters) sometimes ARE quoted. Solution: Always quote the `name` value passed to a VALIDATE macro _unless_ the value has whitespace.
* refactor(api): VALIDATE macros #22256Justin M. Keyes2023-02-14
| | | | | | - VALIDATE() takes a format string - deduplicate check_string_array - VALIDATE_RANGE - validate UI args
* UIEnter/UILeave: fire for embedder UI, builtin TUIJustin M. Keyes2019-09-12
| | | | | | | | | Before this, --embed UIs (without --headless) would not trigger UIEnter. For TUI, maybe UIEnter isn't useful, but: - It is less "surprising"/special. - Makes documentation simpler. - When TUI becomes a coprocess, it will happen anyway.
* rename: UIAttach/UIDetach => UIEnter/UILeaveJustin M. Keyes2019-09-12
| | | | | "enter"/"leave" is more conventional for Vim events, and "attach"/"detach" distinction does not gain much.
* UIAttach, UIDetachJustin M. Keyes2019-09-12
| | | | | doc: ginit.vim, gvimrc fix #3656
* UIAttach, UIDetachRui Abreu Ferreira2019-09-12
|
* test: Eliminate expect_errJustin M. Keyes2019-09-06
| | | | Eliminate `expect_err` in favor of `pcall_err` + `eq` or `matches`.
* test/util: expect_err() (#8257)Justin M. Keyes2018-04-11
| | | other cleanup, ref #8245
* test/API: validate channel arg (#8245)Justin M. Keyes2018-04-08