aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/vim_spec.lua
Commit message (Collapse)AuthorAge
...
* fix(api): use standard error messagesJustin M. Keyes2026-03-16
|
* fix(messages): allocate message history kind string #38292luukvbaal2026-03-14
| | | | Problem: nvim_echo()->kind memory may be used after it is freed with :messages. Solution: Copy and free message kind string in message history.
* docs: miscJustin M. Keyes2026-03-13
|
* fix(api): nvim_parse_cmd on range-only, modifier-only commands #36665glepnir2026-03-13
| | | | | | | Problem: nvim_parse_cmd rejects valid commands like `:1` (range-only) or `aboveleft` (modifier-only). Solution: allow empty command when range or modifiers exist, and handle execution using existing range command logic.
* fix(process): wrong exit code for SIGHUP on Windows (#38242)zeertzjq2026-03-12
| | | | | | | | | Problem: When stopping a PTY process on Windows, the exit code indicates that the process is stopped by SIGTERM even when closing all streams is enough to terminate the process. This is inconsistent with other platforms. Solution: Set exit_signal to SIGHUP instead of SIGTERM when using SIGHUP.
* docs: deprecate hit-enterJustin M. Keyes2026-03-11
|
* test(api/vim_spec): fix flaky test (#38227)zeertzjq2026-03-11
| | | | | | | | | | Problem: Exit code in :terminal channel test depends on whether the shell or Nvim TUI in the terminal has registered its SIGHUP handler when jobstop() is called. Solution: Don't use a shell as shells on different systems may handle SIGHUP differently. Add a screen:expect() to wait for the TUI to start.
* fix(message): concatenate multi-chunk nvim_echo({err}) for exception message ↵luukvbaal2026-03-10
| | | | | | | | #38131 Problem: Exception error message only prints the first chunk of a multi-chunk nvim_echo() message. Solution: Concatenate consecutive message chunks in the exception message list.
* feat(terminal): surface exit code via virttext + nvim_get_chan_info #37987Ayaan2026-03-10
| | | | | | | | | | Problem: When a terminal process exits, "[Process Exited]" text is added to the buffer contents. Solution: - Return `exitcode` field from `nvim_get_chan_info`. - Show it in the default 'statusline'. - Show exitcode as virtual text in the terminal buffer.
* fix(messages): reset redirection message column at message start #38068luukvbaal2026-02-26
| | | | | | | | | Problem: Leading message newlines (not emitted with ext_messages since 4260f73) were responsible for resetting the redirection message column (while the newline itself is later pruned...). Solution: Ensure the redirection column is reset at the start of a message. (Instead of re-adjusting all the newline callsites which can themselves hopefully be pruned if ext_messages is enabled by default.)
* test: support running functionaltests in parallel by directory (#37918)zeertzjq2026-02-18
| | | | | | | | | Define a CMake target for every subdirectory of test/functional that contains functional tests, and a functionaltest_parallel target that depends on all those targets, allowing multiple test runners to run in parallel. On CI, use at most 2 parallel test runners, as using more may increase system load and make tests unstable.
* fix(messages): increment message ID without ext_messages #37714luukvbaal2026-02-05
| | | | | | | | Problem: Message ID is not incremented without ext_messages. Solution: Increment where callstack reaches without ext_messages. There is no clear place marking the end of internal messages without ext_messages so IDs are only incremented with `nvim_echo` calls. Message IDs are currently not exposed anywhere but the msg_show event for this to matter.
* fix(api): parse_expression crash with unopened ] and nodeSean Dewar2026-01-17
| | | | | | | | | | | Problem: nvim_parse_expression null pointer dereference with unmatched ] followed by a node. Solution: if ast_stack was empty, set new_top_node_p to top of the stack after pushing the list literal node; similar to what's done for curlies. This bug was originally found by a Matrix user, but I couldn't remember how to trigger it... Ran into the other crash while finding a repro. :P
* fix(api): parse_expression crash with ident and curlySean Dewar2026-01-17
| | | | | | | | | Problem: nvim_parse_expression null pointer dereference when parsing an identifier followed by { with "highlight" parameter set to false. Solution: only set opening_hl_idx if pstate->colors is not NULL. Not added to parser_tests.lua as that uses highlight = true.
* fix(api): nvim_get_option_value dummy buffer crashesSean Dewar2026-01-15
| | | | | | | | Problem: nvim_get_option_value with "filetype" set can crash if autocommands open the dummy buffer in more windows, or if &bufhidden == "wipe". Solution: Attempt to close all dummy buffer windows before wiping. Promote the dummy buffer to a normal buffer if that fails.
* fix(api): autocmds mess up nvim_get_option_value's dummy bufferSean Dewar2026-01-15
| | | | | | | | Problem: When the "filetype" key is set for nvim_get_option_value, autocommands can crash Nvim by prematurely wiping the dummy buffer, or cause options intended for it to instead be set for unrelated buffers if switched during OptionSet. Solution: Don't crash. Also quash side-effects from setting the buffer options.
* fix(api): nvim_set_current_win doesn't reset Visual mode (#37340)glepnir2026-01-10
| | | | | | | | | | Problem: Using nvim_set_current_win() to switch windows while in Visual mode causes E315 ml_get error when target buffer has fewer lines. This doesn't happen with `:wincmd w` since it properly resets Visual mode when switching buffers. Solution: Reset Visual mode when switching to another buffer, like `:wincmd w`.
* docs: types, news, lua-pluginJustin M. Keyes2025-10-24
| | | | | | - mention "lua_ls", not "luals". https://github.com/neovim/neovim/discussions/36182 Co-authored-by: Maria Solano <majosolano99@gmail.com>
* fix(api): nvim_parse_cmd handle nextcmd for commands without EX_TRLBAR (#36055)glepnir2025-10-13
| | | | | | | Problem: nvim_parse_cmd('exe "ls"|edit foo', {}) fails to separate nextcmd, returning args as { '"ls"|edit', 'foo' } instead of { '"ls"' } with nextcmd='edit foo'. Solution: Skip expressions before checking for '|' separator.
* fix(api): fix not capturing output in cmdline mode (#35322)zeertzjq2025-08-13
|
* fix(clipboard): correct blockwise register width computation (#35038)zeertzjq2025-07-23
|
* fix(api): nvim_parse_cmd parses :map incorrectly #34068glepnir2025-06-14
| | | | | | | Problem: nvim_parse_cmd() incorrectly splits mapping commands like into three arguments instead of preserving whitespace in the RHS. Solution: Add special handling for mapping commands to parse them as exactly two arguments - the LHS and the RHS with all whitespace preserved.
* fix(messages): recognize cmdline one_key/number prompt State (#34206)luukvbaal2025-06-09
| | | | | | | | | | Problem: Since 48e2a736, prompt messages are handled by an actual active cmdline, resulting in `State` no longer being equal to `MODE_CONFIRM` which is used in some places. E.g. to specify the current `mode()` or to re-emit a confirm message. Solution: Replace `MODE_CONFIRM` with a new `MODE_CMDLINE` sub-mode when `ccline.one_key/mouse_used` is set. Use it to avoid clearing mouse_used prompt messages, and to re-emit one_key messages (when ext_messages is inactive, for which this is unnecessary).
* fix(api): count parameter in nvim_parse_cmd, nvim_cmd #34253glepnir2025-06-09
| | | | | | | | | Problem: - nvim_parse_cmd('copen', {}) returns count: 0, causing nvim_cmd to override default behavior - nvim_cmd({cmd = 'copen', args = {10}}, {}) fails with "Wrong number of arguments" Solution: - Only include count field in parse result when explicitly provided or non-zero - Interpret single numeric argument as count for count-only commands like copen
* fix(api): update topline when flushing with nvim__redraw() (#34346)luukvbaal2025-06-07
| | | | | Problem: nvim__redraw may update the screen with an invalid topline. Solution: Update the topline before calling `update_screen()` (as :redraw does).
* feat(api): nvim_cmd supports plus ("+cmd", "++opt") flags #30103glepnir2025-05-05
| | | | | | | Problem: nvim_cmd does not handle plus flags. Solution: In nvim_cmd, parse the flags and set the relevant `ea` fields.
* feat(messages): cleanup Lua error messagesJustin M. Keyes2025-05-04
| | | | | "Error" in error messages is redundant. Just provide the context, don't say "Error ...".
* Merge pull request #28344 from bfredl/wonderlandbfredl2025-05-02
|\ | | | | feat(build): build.zig MVP: build and run functionaltests on linux
| * feat(build): build.zig MVP: build and run functionaltests on linuxbfredl2025-05-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NEW BUILD SYSTEM! This is a MVP implementation which supports building the "nvim" binary, including cross-compilation for some targets. As an example, you can build a aarch64-macos binary from an x86-64-linux-gnu host, or vice versa Add CI target for build.zig currently for functionaltests on linux x86_64 only Follow up items: - praxis for version and dependency bumping - windows 💀 - full integration of libintl and gettext (or a desicion not to) - update help and API metadata files - installation into a $PREFIX - more tests and linters
* | feat(terminal): parse current buffer contents in nvim_open_term() (#33720)Gregory Anders2025-04-30
|/ | | | When nvim_open_term() is called with a non-empty buffer, the buffer contents are piped into the PTY.
* fix(api): nvim_parse_cmd "range" when ea.addr_count=0 #33536Au.2025-04-23
| | | | | | | | | | Problem: nvim_parse_cmd returns invalid 'range' field for cmd like `:bdelete`. Solution: Add the condtion `ea.add_count > 0` as required to put 'range' into result. Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* fix(paste): wrong '[ mark after pasting a big string (streamed chunks) #33025Au.2025-03-23
| | | | | | | | | | | | | Problem Pasting a big string ("streamed paste" with multiple chunks) sets the '[ mark to the edit from the last chunk, instead of the start of the paste. Solution: Set the '[ mark where the paste started, not where the last chunk was inserted. Note: `startpos == nil` is not equal to `phase == 1` because there may be some empty chunks pasted which won't arrive here (returned at code before).
* feat(defaults): jump between :terminal shell prompts with ]]/[[ #32736Gregory Anders2025-03-07
|
* vim-patch:8.2.4603: sourcing buffer lines is too complicatedzeertzjq2025-02-28
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Sourcing buffer lines is too complicated. Solution: Simplify the code. Make it possible to source Vim9 script lines. (Yegappan Lakshmanan, closes vim/vim#9974) https://github.com/vim/vim/commit/85b43c6cb7d56919e245622f4e42db6d8bee4194 This commit changes the behavior of sourcing buffer lines to always have a script ID, although sourcing the same buffer always produces the same script ID. vim-patch:9.1.0372: Calling CLEAR_FIELD() on the same struct twice Problem: Calling CLEAR_FIELD() on the same struct twice. Solution: Remove the second CLEAR_FIELD(). Move the assignment of cookie.sourceing_lnum (zeertzjq). closes: vim/vim#14627 https://github.com/vim/vim/commit/f68517c1671dfedcc1555da50bc0b3de6d2842f6 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
* fix(event-loop): process input before events in getchar() (#32322)zeertzjq2025-02-05
| | | Follow-up to #27358.
* feat(api): combined highlights in nvim_eval_statusline()Luuk van Baal2025-01-23
| | | | | | | | | | | Problem: Combined highlighting was not applied to nvim_eval_statusline(), and 'statuscolumn' sign segment/numhl highlights. Solution: Add an additional `groups` element to the return value of `nvim_eval_statusline()->highlights`. This is an array of stacked highlight groups (highest priority last). Also resolve combined highlights for the 'statuscolumn' sign segment/numhl highlights. Expose/synchronize some drawline.c logic that is now mimicked in three different places.
* refactor(api): deprecate nvim_notify #31938Justin M. Keyes2025-01-10
| | | | | | | | | | Problem: The `nvim_notify` API (note: unrelated to `vim.notify()` Lua API) was not given any real motivation in https://github.com/neovim/neovim/pull/13843 There are, and were, idiomatic and ergonomic alternatives already. Solution: Deprecate `nvim_notify`.
* feat(api): add err field to nvim_echo() optsLuuk van Baal2025-01-09
| | | | | | | | Problem: We want to deprecate `nvim_err_write(ln)()` but there is no obvious replacement (from Lua). Meanwhile we already have `nvim_echo()` with an `opts` argument. Solution: Add `err` argument to `nvim_echo()` that directly maps to `:echoerr`.
* fix(api): clamp range lines in `nvim__redraw()` (#31710)Artem2024-12-25
| | | | | | | | | | | | | | | Problem: `nvim__redraw()` doesn't clamp the lines in the `range` parameter before truncating to int. The resulting range may be empty when the original range contained buffer lines and vice versa. E.g. for a buffer with 4 lines, these are the redrawn lines: ```lua { 2, 2 ^ 31 } -> none (should be { 2, 3 }) { 2, 2 ^ 32 } -> none (should be { 2, 3 }) { 2 ^ 32 - 1, 2 } -> { 0, 1 } (should be none) ``` Solution: Clamp `range` values before truncating to int.
* feat(jobs): jobstart(…,{term=true}), deprecate termopen() #31343Justin M. Keyes2024-12-19
| | | | | | | | | | | | Problem: `termopen` has long been a superficial wrapper around `jobstart`, and has no real purpose. Also, `vim.system` and `nvim_open_term` presumably will replace all features of `jobstart` and `termopen`, so centralizing the logic will help with that. Solution: - Introduce `eval/deprecated.c`, where all deprecated eval funcs will live. - Introduce "term" flag of `jobstart`. - Deprecate `termopen`.
* 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(api): generic error messages, not using TRY_WRAP #31596Justin M. Keyes2024-12-16
| | | | | | | | | | | Problem: - API functions using `try_start` directly, do not surface the underlying error message, and instead show generic messages. - Error-handling code is duplicated in the API impl. - Failure modes are not tested. Solution: - Use `TRY_WRAP`. - Add tests.
* fix(api): don't try to get/set option for invalid option name (#31302)Famiu Haque2024-11-22
| | | | | | | | | | | | | | | | Problem: `validate_option_value_args()` returns `OK` even if option name is invalid or if option doesn't have the supported scope, which leads to Neovim still trying to erroneously get/set the option in those cases, which can lead to an assertion failure when `option_has_scope()` is invoked. This issue miraculously doesn't exist in release builds since the assertion is skipped and `(get/set)_option_value_for` returns if there is an error set, but that is not the intended location for that error to be caught. Solution: Make `validate_option_value_args()` return `FAIL` if there is an error set, which causes the API option functions to return early instead of trying to get/set an invalid option.
* fix(api): validation, documentation of hl_group #31195luukvbaal2024-11-16
| | | | | | | | Problem: Documentation for "hl_group" in nvim_buf_set_extmark() is unclear. "hl_group" in nvim_echo() does not accept highlight group id. Solution: Move documentation for highlight group name/id to first mention of hl_group. Update nvim_echo() to accept highlight group id.
* 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.
* fix(paste): only record a paste when it's from RPC (#30491)zeertzjq2024-09-24
| | | | | | | | | Problem: When using nvim_paste in a mapping during a macro recording, both the mapping and the paste are recorded, causing the paste to be performed twice when replaying the macro. Solution: Only record a paste when it is from RPC. Unfortunately this means there is no way for a script to make a recorded paste. A way to enable that can be discussed later if there is need.
* feat(paste): unify cancel and error behavior (#30476)zeertzjq2024-09-24
| | | | | | | | | | | | | | | | | | | | | | | | Before this PR, the behavior of nvim_paste is: - When vim.paste() returns false, return false to the client, but treat following chunks normally (i.e. rely on the client cancelling the paste as expected). - When vim.paste() throws an error, still return true to the client, but drain the following chunks in the stream without calling vim.paste(). There are two problems with such behavior: - When vim.paste() errors, the client is still supposed to send the remaining chunks of the stream, even though they do nothing. - Having different code paths for two uncommon but similar situations complicates maintenance. This PR makes both the cancel case and the error case return false to the client and drain the remaining chunks of the stream, which, apart from sharing the same code path, is beneficial whether the client checks the return value of nvim_paste or not: - If the client checks the return value, it can avoid sending the following chunks needlessly after an error. - If the client doesn't check the return value, chunks following a cancelled chunk won't be pasted on the server regardless, which leads to less confusing behavior.
* refactor(api)!: rename Dictionary => DictJustin M. Keyes2024-09-23
| | | | | | | | | | | | | | In the api_info() output: :new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val') ... {'return_type': 'ArrayOf(Integer, 2)', 'name': 'nvim_win_get_position', 'method': v:true, 'parameters': [['Window', 'window']], 'since': 1} The `ArrayOf(Integer, 2)` return type didn't break clients when we added it, which is evidence that clients don't use the `return_type` field, thus renaming Dictionary => Dict in api_info() is not (in practice) a breaking change.
* docs(api): nvim_get_runtime_file preserves 'runtimepath' order #30454Evgeni Chasnovski2024-09-22
|
* fix(paste): improve repeating of pasted text (#30438)zeertzjq2024-09-22
| | | | | | | - Fixes 'autoindent' being applied during redo. - Makes redoing a large paste significantly faster. - Stores pasted text in the register being recorded. Fix #28561