summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/ui/cmdline_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-15vim-patch:9.2.0346: Wrong cursor position when entering command line window ↵zeertzjq1
(#39072) Problem: Wrong cursor position when entering command line window Solution: Add check_cursor() command to verify the cursor position (Hirohito Higashi). When opening the command-line window with CTRL-F after typing a command that fills the screen width, the cursor was placed past the end of the line. Add check_cursor() after setting State to MODE_NORMAL so the cursor is adjusted to the last character. Also fix the cmdwin prefix character (e.g. ':') being drawn on wrapped continuation rows. Draw an empty space instead so that the text alignment is preserved. closes: vim/vim#19964 https://github.com/vim/vim/commit/c4fe1e958a2051d443abe072c8a5366a887da9b3 Cherry-pick Test_wildmenu_pum() changes from patch 9.1.1995. Co-authored-by: Hirohito Higashi <h.east.727@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14fix(cmdline): avoid Ex-mode NULL cmdline_block event #39043luukvbaal1
Problem: Attempting to emit cmdline_block event with NULL cmdbuff after <C-\><C-N> in Ex-mode. Solution: Don't emit cmdline_block event when cmdbuff is NULL.
2026-03-28docs: news #38464Justin M. Keyes1
2026-03-27fix(messages): spurious newline with --headless + cmdheight=0 #38494kq1
Problem: When running nvim in headless mode with `cmdheight=0`, an extra newline is prepended to output (eg. `nvim --clean --cmd 'set cmdheight=0' --headless -c 'echo 1 | q' ` prints `\n1` instead of `1`), because `!ui_has(kUIMessages)` is always true in headless mode, causing `p_ch == 0` in `msg_start()` to unconditionally trigger `msg_putchar('\n')` which writes a newline to stdout. Solution: When in headless printf mode with `p_ch == 0` and no prior output on the current line, call `msg_puts_display("\n", ...)` directly instead of `msg_putchar('\n')`, so the grid is still updated for correct screen positioning but no newline is written to stdout.
2026-03-06fix(cmdline): cmdline_block events for :lua debug.debug() #38171luukvbaal1
Problem: :lua debug.debug() is missing cmdline_block events. Solution: Emit cmdline_block_show/append/hide events for :lua debug.debug().
2026-02-06fix(ui): cmdline_block events for exmode #37751luukvbaal1
Problem: Exmode is missing cmdline_block events. Solution: Emit cmdline_block_show/append when executing a cmdline during exmode. Emit cmdline_block_hide when leaving exmode.
2025-09-09fix(cmdline): fix inconsistent behavior with ext_popupmenu (#35688)zeertzjq1
2025-09-08test: add tests for #20348zeertzjq1
2025-08-20fix(ui): proper event ordering for nested cmdline_block events (#35344)luukvbaal1
Problem: Wrong event order for nested cmdline in a conditional cmdline_block. Solution: Emit all but the first cmdline_block event immediately after getting the next command, before executing it.
2025-08-07fix(ui): check for cmdline mode properly (#35202)zeertzjq1
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-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-05-02feat(messages): hl-StderrMsg, hl-StdoutMsg #33429Sathya Pramodh1
Problem: stderr messages from executing ":!cmd" show up with highlight hl-ErrorMsg. But some shell utilites use stderr for debug logging, progress updates, etc. Solution: Highlight shell command outputs hl-StderrMsg and hl-StdoutMsg.
2025-03-28fix(cmdline): avoid empty @: register after :<CR> (#33126)luukvbaal1
Fix https://github.com/neovim/neovim/issues/33125
2025-03-28fix(cmdline): empty ext_cmdline block events for :<CR> #33118luukvbaal1
Problem: An ext_cmdline block event that should be empty after :<CR> re-emits the previous cmdline. Solution: Clear `last_cmdline` even when `new_last_cmdline == NULL`.
2025-03-28vim-patch:9.1.1243: diff mode is lacking for changes within lineszeertzjq1
Problem: Diff mode's inline highlighting is lackluster. It only performs a line-by-line comparison, and calculates a single shortest range within a line that could encompass all the changes. In lines with multiple changes, or those that span multiple lines, this approach tends to end up highlighting much more than necessary. Solution: Implement new inline highlighting modes by doing per-character or per-word diff within the diff block, and highlight only the relevant parts, add "inline:simple" to the defaults (which is the old behaviour) This change introduces a new diffopt option "inline:<type>". Setting to "none" will disable all inline highlighting, "simple" (the default) will use the old behavior, "char" / "word" will perform a character/word-wise diff of the texts within each diff block and only highlight the differences. The new char/word inline diff only use the internal xdiff, and will respect diff options such as algorithm choice, icase, and misc iwhite options. indent-heuristics is always on to perform better sliding. For character highlight, a post-process of the diff results is first applied before we show the highlight. This is because a naive diff will create a result with a lot of small diff chunks and gaps, due to the repetitive nature of individual characters. The post-process is a heuristic-based refinement that attempts to merge adjacent diff blocks if they are separated by a short gap (1-3 characters), and can be further tuned in the future for better results. This process results in more characters than necessary being highlighted but overall less visual noise. For word highlight, always use first buffer's iskeyword definition. Otherwise if each buffer has different iskeyword settings we would not be able to group words properly. The char/word diffing is always per-diff block, not per line, meaning that changes that span multiple lines will show up correctly. Added/removed newlines are not shown by default, but if the user has 'list' set (with "eol" listchar defined), the eol character will be be highlighted correctly for the specific newline characters. Also, add a new "DiffTextAdd" highlight group linked to "DiffText" by default. It allows color schemes to use different colors for texts that have been added within a line versus modified. This doesn't interact with linematch perfectly currently. The linematch feature splits up diff blocks into multiple smaller blocks for better visual matching, which makes inline highlight less useful especially for multi-line change (e.g. a line is broken into two lines). This could be addressed in the future. As a side change, this also removes the bounds checking introduced to diff_read() as they were added to mask existing logic bugs that were properly fixed in vim/vim#16768. closes: vim/vim#16881 https://github.com/vim/vim/commit/9943d4790e42721a6777da9e12637aa595ba4965 Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-03-27fix(ui): wincmd _ should not increase 'cmdheight' above 0 (#33056)luukvbaal1
2025-03-15fix(cmdline): ext_cmdline block events for conditionalsLuuk van Baal1
Problem: No block events emitted with ext_cmdline for :if, :while, :try etc. Solution: Emit cmdline block events; store the indent level of the previous cmdline and whether a block event was emitted.
2025-01-26feat(diagnostic): virtual_lines #31959Maria José Solano1
2025-01-22fix(editor): avoid scrolling :substitute confirm message #32149luukvbaal1
Regression from 48e2a73.
2025-01-05fix(cmdline): always show cmdline when it is a prompt #31866luukvbaal1
Cmdline prompts should ignore `cmd_silent`.
2025-01-02feat(ui): more intuitive :substitute confirm prompt #31787luukvbaal1
Problem: Unknown key mappings listed in substitute confirm message. Solution: Include hints as to what the key mappings do.
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-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-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-11refactor(tests): use more global highlight definitionsbfredl1
2024-05-02feat(api): add nvim__redraw for more granular redrawingLuuk van Baal1
Experimental and subject to future changes. Add a way to redraw certain elements that are not redrawn while Nvim is waiting for input, or currently have no API to do so. This API covers all that can be done with the :redraw* commands, in addition to the following new features: - Immediately move the cursor to a (non-current) window. - Target a specific window or buffer to mark for redraw. - Mark a buffer range for redraw (replaces nvim__buf_redraw_range()). - Redraw the 'statuscolumn'.
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-21Merge pull request #27872 from luukvbaal/cmdheightbfredl1
fix(ui): don't force 'cmdheight' to zero with ext_messages
2024-04-21fix(api): do not update grid position in nvim_win_set_cursor (#28235)luukvbaal1
Revert commit c971f538ab87b537ae4c97bd44167661c5691a2d. Forcing grid cursor position will need a new API like originally proposed in #27858.
2024-04-20fix(ui): don't force 'cmdheight' to zero with ext_messagesLuuk van Baal1
Remove remaining code that prevents non-zero 'cmdheight' with ext_messages.
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-03vim-patch:9.0.0581: adding a character for incsearch fails at end of linezeertzjq1
Problem: Adding a character for incsearch fails at end of line. Solution: Only check cursor line number. https://github.com/vim/vim/commit/d4566c14e71c55dcef05fb34ea94eba835831527 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-03-26refactor(tests): use new global defaults instead of set_default_attr_idsbfredl1
This will be done in batches.
2024-03-15fix(ui): ext_cmdline should not move cursor to curwinLuuk van Baal1
Problem: The ext_cmdline cursor position on the screen seems to rely on an implicit assumption that the event listener implements a cmdline window that is made the current window which is problematic (e.g. breaks 'incsearch' in the actual current window). Solution: Remove this assumption and allow nvim_win_set_cursor() to move the cursor on the screen to a non-current window (previous commit).
2024-02-15vim-patch:9.1.0106: Visual highlight hard to read with 'termguicolors'zeertzjq1
Problem: Visual highlight hard to read with 'termguicolors' (Maxim Kim) Solution: Set Visual GUI foreground to black (with background=light) and lightgrey (with background=dark) (Maxim Kim) fixes: vim/vim#14024 closes: vim/vim#14025 https://github.com/vim/vim/commit/34e4a05d02a016fe230495be8f6c60ddd56f9567 Co-authored-by: Maxim Kim <habamax@gmail.com>
2024-01-16test: use integers for API Buffer/Window/Tabpage EXT typesLewis Russell1
2024-01-12test: rename (meths, funcs) -> (api, fn)Lewis Russell1
2024-01-12test: typing for helpers.methsLewis 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-11-03refactor(grid): implement rightleftcmd as a post-processing stepbfredl1
Previously, 'rightleftcmd' was implemented by having all code which would affect msg_col or output screen cells be conditional on `cmdmsg_rl`. This change removes all that and instead implements rightleft as a mirroring post-processing step.
2023-09-24fix(ui): "resize -1" with cmdheight=0 #24758nwounkn1
Problem: Crash from: set cmdheight=0 redrawdebug=invalid resize -1 Solution: Do not invalidate first `p_ch` `msg_grid` rows in `update_screen` when scrolling the screen down after displaying a message, because they may be used later for drawing cmdline. Fixes #22154
2023-09-20fix(test): fix "indeterminism" warnings in UI testsbfredl1
2023-08-22vim-patch:9.0.0579: using freed memory when 'tagfunc' wipes out buffer (#24838)zeertzjq1
Problem: Using freed memory when 'tagfunc' wipes out buffer that holds 'complete'. Solution: Make a copy of the option. Make sure cursor position is valid. https://github.com/vim/vim/commit/0ff01835a40f549c5c4a550502f62a2ac9ac447c Cherry-pick a cmdwin change from patch 9.0.0500. Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-17vim-patch:9.0.1726: incorrect heights in win_size_restore() (#24765)Sean Dewar1
Problem: incorrect heights in win_size_restore() Solution: avoid restoring incorrect heights in win_size_restore() https://github.com/vim/vim/commit/876f5fb570d8401aa4c58af4a5da91f10520aa9d I already merged this prior, so just replace the new test with the old one, but add a test case for the global statusline.
2023-07-26fix(window): prevent win_size_restore from changing cmdheightSean Dewar1
Currently it only skips if `Rows` changed, but it's possible for the height of the usable area for windows to change (e.g: via `&ch`, `&stal` or `&ls`), which can cause the value of `&cmdheight` to change when the sizes are restored. This is a Vim bug, so I've submitted a PR there too. No telling when it'll be merged though, given the current lack of activity there. `ROWS_AVAIL` is convenient here, but also subtracts the `global_stl_height()`. Not ideal, as we also care about the height of the last statusline for other values of `&ls`. Meh. Introduce `last_stl_height` for getting the height of the last statusline and use it in `win_size_save/restore` and `last_status` (means `last_status_rec`'s `statusline` argument will now be true if `&ls` is 3, but that does not change the behaviour). Also corrects the logic in `comp_col` to not assume there's a last statusline if `&ls` is 1 and the last window is floating.
2023-06-23fix(cmdline): don't redraw 'tabline' in Ex mode (#24123)zeertzjq1
Redrawing of 'statusline' and 'winbar' are actually already inhibited by RedawingDisabled in Ex mode. In Vim there is a check for `msg_scrolled == 0` (which is false in Ex mode) since Vim doesn't have msgsep. Add a `!exmode_active` check here in Nvim instead.
2023-03-12feat(ui): add scroll_delta to win_viewport event #19270Matthias Deiml1
scroll_delta contains how much the top line of a window moved since the last time win_viewport was emitted. It is expected to be used to implement smooth scrolling. For this purpose it only counts "virtual" or "displayed" so folds should count as one line. Because of this it adds extra information that cannot be computed from the topline parameter. Fixes #19227