summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/api/vim_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-24fix(path): normalize path slashes on Windows #37729tao1
Problem: On Windows, path separators may become inconsistent for various reasons, which makes normalization quite painful. Solution: Normalize paths to `/` at the entry boundaries and always use it internally, converting back only in rare cases where `\` is really needed (e.g. cmd.exe/bat scripts?). This is the first commit in a series of incremental steps. Note: * some funcs won't respect shellslash. e.g. `expand/fnamemodify` * some funcs still respect shellslash, but will be updated in a follow PR. e.g. `ex_pwd/f_chdir/f_getcwd` * uv's built-in funcs always return `\`. e.g. `uv.cwd/uv.exepath` Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-04-20refactor(test): drop deprecated exc_exec #39242Justin M. Keyes1
2026-04-18fix(terminal): forward streamed bracketed paste properly (#39152)zeertzjq1
2026-04-13feat(api): rename buffer to buf in retval #38900Justin M. Keyes1
In 3a4a66017b74192caaf9af9af172bdc08e0c1608, 4d3a67cd620152d11ab9b5f5bdd973f84cc2d44b we renamed "buffer" to "buf" in dict parameters. This commit also renames such keys in dict return-values.
2026-04-01fix(api): avoid error when parsing invalid expr after :echo (#38695)zeertzjq1
Problem: Parsing :echo followed by invalid expression leads to error. Solution: Suppress error when skipping over expression.
2026-03-18fix(messages): disallow user-defined integer message-id #38359Justin M. Keyes1
Problem: `nvim_echo(…, {id=…})` accepts user-defined id as a string or integer. Generated ids are always higher than last highest msg-id used. Thus plugins may accidentally advance the integer id "address space", which, at minimum, could lead to confusion when troubleshooting, or in the worst case, could overflow or "exhaust" the id address space. There's no use-case for it, and it could be the mildly confusing, so we should just disallow it. Solution: Disallow *integer* user-defined message-id. Only allow *string* user-defined message-id.
2026-03-18fix(api): nvim_get_option_value FileType autocmd handling #37414Sean Dewar1
Problem: nvim_get_option_value with "filetype" set silently returns incorrect defaults if autocommands are blocked, like when they're already running. Solution: Allow its FileType autocommands to nest: `do_filetype_autocmd(force=true)`. Also error if executing them fails, rather than silently return wrong defaults. Endless nesting from misbehaving scripts should be prevented by the recursion limit in apply_autocmds_group, which is 10.
2026-03-16fix(api): use standard error messagesJustin M. Keyes1
2026-03-14fix(messages): allocate message history kind string #38292luukvbaal1
Problem: nvim_echo()->kind memory may be used after it is freed with :messages. Solution: Copy and free message kind string in message history.
2026-03-13docs: miscJustin M. Keyes1
2026-03-13fix(api): nvim_parse_cmd on range-only, modifier-only commands #36665glepnir1
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.
2026-03-12fix(process): wrong exit code for SIGHUP on Windows (#38242)zeertzjq1
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.
2026-03-11docs: deprecate hit-enterJustin M. Keyes1
2026-03-11test(api/vim_spec): fix flaky test (#38227)zeertzjq1
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.
2026-03-10fix(message): concatenate multi-chunk nvim_echo({err}) for exception message ↵luukvbaal1
#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.
2026-03-10feat(terminal): surface exit code via virttext + nvim_get_chan_info #37987Ayaan1
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.
2026-02-26fix(messages): reset redirection message column at message start #38068luukvbaal1
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.)
2026-02-18test: support running functionaltests in parallel by directory (#37918)zeertzjq1
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.
2026-02-05fix(messages): increment message ID without ext_messages #37714luukvbaal1
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.
2026-01-17fix(api): parse_expression crash with unopened ] and nodeSean Dewar1
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
2026-01-17fix(api): parse_expression crash with ident and curlySean Dewar1
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.
2026-01-15fix(api): nvim_get_option_value dummy buffer crashesSean Dewar1
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.
2026-01-15fix(api): autocmds mess up nvim_get_option_value's dummy bufferSean Dewar1
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.
2026-01-10fix(api): nvim_set_current_win doesn't reset Visual mode (#37340)glepnir1
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`.
2025-10-24docs: types, news, lua-pluginJustin M. Keyes1
- mention "lua_ls", not "luals". https://github.com/neovim/neovim/discussions/36182 Co-authored-by: Maria Solano <majosolano99@gmail.com>
2025-10-13fix(api): nvim_parse_cmd handle nextcmd for commands without EX_TRLBAR (#36055)glepnir1
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.
2025-08-13fix(api): fix not capturing output in cmdline mode (#35322)zeertzjq1
2025-07-23fix(clipboard): correct blockwise register width computation (#35038)zeertzjq1
2025-06-14fix(api): nvim_parse_cmd parses :map incorrectly #34068glepnir1
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.
2025-06-09fix(messages): recognize cmdline one_key/number prompt State (#34206)luukvbaal1
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).
2025-06-09fix(api): count parameter in nvim_parse_cmd, nvim_cmd #34253glepnir1
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
2025-06-07fix(api): update topline when flushing with nvim__redraw() (#34346)luukvbaal1
Problem: nvim__redraw may update the screen with an invalid topline. Solution: Update the topline before calling `update_screen()` (as :redraw does).
2025-05-05feat(api): nvim_cmd supports plus ("+cmd", "++opt") flags #30103glepnir1
Problem: nvim_cmd does not handle plus flags. Solution: In nvim_cmd, parse the flags and set the relevant `ea` fields.
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-05-02Merge pull request #28344 from bfredl/wonderlandbfredl1
feat(build): build.zig MVP: build and run functionaltests on linux
2025-05-02feat(build): build.zig MVP: build and run functionaltests on linuxbfredl1
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
2025-04-30feat(terminal): parse current buffer contents in nvim_open_term() (#33720)Gregory Anders1
When nvim_open_term() is called with a non-empty buffer, the buffer contents are piped into the PTY.
2025-04-23fix(api): nvim_parse_cmd "range" when ea.addr_count=0 #33536Au.1
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>
2025-03-23fix(paste): wrong '[ mark after pasting a big string (streamed chunks) #33025Au.1
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).
2025-03-07feat(defaults): jump between :terminal shell prompts with ]]/[[ #32736Gregory Anders1
2025-02-28vim-patch:8.2.4603: sourcing buffer lines is too complicatedzeertzjq1
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>
2025-02-05fix(event-loop): process input before events in getchar() (#32322)zeertzjq1
Follow-up to #27358.
2025-01-23feat(api): combined highlights in nvim_eval_statusline()Luuk van Baal1
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.
2025-01-10refactor(api): deprecate nvim_notify #31938Justin M. Keyes1
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`.
2025-01-09feat(api): add err field to nvim_echo() optsLuuk van Baal1
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`.
2024-12-25fix(api): clamp range lines in `nvim__redraw()` (#31710)Artem1
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.
2024-12-19feat(jobs): jobstart(…,{term=true}), deprecate termopen() #31343Justin M. Keyes1
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`.
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-12-16fix(api): generic error messages, not using TRY_WRAP #31596Justin M. Keyes1
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.
2024-11-22fix(api): don't try to get/set option for invalid option name (#31302)Famiu Haque1
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.