aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/cmdline_spec.lua
Commit message (Collapse)AuthorAge
* fix(ruler)!: consistent width in last line and statuslineSébastien Hoffmann2026-08-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Traditionally, the ruler in the last line is one cell shorter than in the statusline, leaving the last cell of the screen blank. According to code comments, this is in order to prevent unwanted scrolling on "some" (unspecified, but presumably ancient) terminals. Berkeley vi is more specific in its `vs_modeline` function: dumb terminals with hardware scroll, SunOS 4.1.1 and Ultrix 4.2 curses. (n)curses still has a similar limitation in `(w)addstr`, but apparently only for historical reasons. Maintaining the different widths leads to awkward inconsistencies when the ruler is configured with 'rulerformat', except for the special case where it contains a top-level `%=`. Shifting the ruler in the last line to the left would be a solution, but the empty cell at the end doesn't seem to be relevant anymore. Solution: extend the ruler in the last line all the way to the right edge of the screen, just like in the statusline. The exact same amount of place will be available to the rest of the UI as before. BREAKING CHANGE: - the default ruler width is now 18 cells - the last cell of the screen is no longer empty Closes #41076
* 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`.
* vim-patch:8.2.4738: Esc on commandline executes command instead of abandoning itzeertzjq2026-01-24
| | | | | | | | | | | | | Problem: Esc on commandline executes command instead of abandoning it. Solution: Save and restore KeyTyped when removing the popup menu. (closes vim/vim#10154) https://github.com/vim/vim/commit/11a57dfd16a47f248fe949344bd5db3f12b9bd32 No code change is needed in Nvim as Nvim doesn't call update_screen() to redraw pum. Co-authored-by: Bram Moolenaar <Bram@vim.org>
* fix(ui): close outdated cmdline pum on redraw (#36815)zeertzjq2025-12-05
|
* fix(cmdline): make sure pum is removed on leave (#36608)zeertzjq2025-11-19
|
* vim-patch:9.1.1871: Wrong 'showcmd' in the cmdwin (#36320)zeertzjq2025-10-25
| | | | | | | | | Problem: Wrong 'showcmd' in the command-line window. Solution: Clear 'showcmd' when entering cmdwin (zeertzjq). related: neovim/neovim#36271 closes: vim/vim#18616 https://github.com/vim/vim/commit/826326f13b0af34b5f1c6f15e480dfaece3787c6
* vim-patch:9.1.1817: popup: there are some position logic bugs (#36075)zeertzjq2025-10-08
| | | | | | | | | | | | | | | | | | | | | | | Problem: popup: there are some position logic bugs Solution: Refactor position logic and fix a few bugs (Girish Palya). This change does the following: - Simplified and rewrote horizontal positioning logic (was overly complex). - Split horizontal and vertical positioning into separate functions. - Fixed missing truncation marker (e.g. `>`) when items were truncated and `pummaxwidth` was not set. - Fixed occasional extra space being added to menu items. - Update tests closes: vim/vim#18441 https://github.com/vim/vim/commit/e3ed5584ed7fad7070d49ddfba4f41bc2b22ca97 Cherry-pick pum_display_{rtl,ltr}_text() changes from patch 9.1.1835. Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1771: complete: some redraw issues with 'autocomplete'zeertzjq2025-09-19
| | | | | | | | | | | | | | | | | | | Problem: complete: some redraw issues with 'autocomplete' Solution: Fix the issues (Girish Palya) This commit contains the following changes: * Fix that wildtrigger() might leave opened popupmenu around vim/vim#18298 * Remove blinking message on the command line when a menu item from a loaded buffer is selected during 'autocomplete' * Add a test for PR vim/vim#18265 to demonstrate why the PR is required for correct 'autocomplete' behavior fixes: vim/vim#18298 closes: vim/vim#18328 https://github.com/vim/vim/commit/ee9a2f0512e8b732e3c6a000974aa7e3f6028989 Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1621: flicker in popup menu during cmdline autocompletionzeertzjq2025-09-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: When the popup menu (PUM) occupies more than half the screen height, it flickers whenever a character is typed or erased. This happens because the PUM is cleared and the screen is redrawn before a new PUM is rendered. The extra redraw between menu updates causes visible flicker. Solution: A complete, non-hacky fix would require removing the CmdlineChanged event from the loop and letting autocompletion manage the process end-to-end. This is because screen redraws after any cmdline change are necessary for other features to work. This change modifies wildtrigger() so that the next typed character defers the screen update instead of redrawing immediately. This removes the intermediate redraw, eliminating flicker and making cmdline autocompletion feel smooth (Girish Palya). Trade-offs: This behavior change in wildtrigger() is tailored specifically for :h cmdline-autocompletion. wildtrigger() now has no general-purpose use outside this scenario. closes: vim/vim#17932 https://github.com/vim/vim/commit/da9c9668931e5c8ee4dc0e430898ad2d80f56862 Use pum_check_clear() instead of update_screen(). Cherry-pick Test_wildtrigger_update_screen() change from patch 9.1.1682. Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1676: completion: long line shown twicezeertzjq2025-09-08
| | | | | | | | | | | | | | | | | | | Problem: completion: long line shown twice (Maxim Kim) Solution: Fix the issue, disable an incorrect test. (Girish Palya) fixes: vim/vim#18035 closes: vim/vim#18088 https://github.com/vim/vim/commit/57379302aa2a82ee0c9aca49ddd681308cf1483c Omit removal of blank line in Test_noselect_expand_env_var() as it's added again in patch 9.1.1682. Cherry-pick two blank lines in Test_long_line_noselect() from patch 9.1.1682. Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1604: completion: incsearch highlight might be lost (#35236)zeertzjq2025-08-08
| | | | | | | | | | | | | | | | Problem: completion: incsearch highlight might be lost after search completion (Hirohito Higashi) Solution: Restore incsearch highlight after dismissing pum with Ctrl-E (Girish Palya) related: vim/vim#17870 closes: vim/vim#17891 https://github.com/vim/vim/commit/04c9e78cd33216dfd2cc59b748d1e267d6920c9a This change actually isn't needed as Nvim doesn't call update_screen() to redraw pum, but it doesn't hurt either. Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1596: tests: Test_search_wildmenu_iminsert() depends on help ↵zeertzjq2025-08-07
| | | | | | | | | | | | | file (#35210) Problem: tests: Test_search_wildmenu_iminsert() depends on help file (after 9.1.1594). Solution: Set buffer text using setline() instead of loading help file. Add a test for another bug fixed by 9.1.1594 (zeertzjq). related: vim/vim#17870 closes: vim/vim#17922 https://github.com/vim/vim/commit/615ad4ced1825d2c6099b4bc36312c02b6c01c8a
* vim-patch:9.1.1594: completion: search completion throws errors (#35198)zeertzjq2025-08-06
| | | | | | | | | | | | Problem: completion: search completion throws errors, wrong placement of pum menu with 'imi'=1 (berggeist) Solution: Fix those errors (Girish Palya) fixes: vim/vim#17858 closes: vim/vim#17870 https://github.com/vim/vim/commit/66467cf5d80a2dcc19cc8de3747b5ecddde71996 Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1516: tests: no test that 'incsearch' is updated after search ↵zeertzjq2025-07-06
| | | | | | | | | | | completion (#34808) Problem: tests: no test that 'incsearch' is updated after accepting search completion. Solution: Add a test case (zeertzjq). closes: vim/vim#17682 https://github.com/vim/vim/commit/08e5b128b8fa274bc66774a79363f199cb09ced4
* vim-patch:9.1.1490: 'wildchar' does not work in search contextszeertzjq2025-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: 'wildchar' does not work in search contexts Solution: implement search completion when 'wildchar' is typed (Girish Palya). This change enhances Vim's command-line completion by extending 'wildmode' behavior to search pattern contexts, including: - '/' and '?' search commands - ':s', ':g', ':v', and ':vim' commands Completions preserve the exact regex pattern typed by the user, appending the completed word directly to the original input. This ensures that all regex elements — such as '<', '^', grouping brackets '()', wildcards '\*', '.', and other special characters — remain intact and in their original positions. --- **Use Case** While searching (using `/` or `?`) for lines containing a pattern like `"foobar"`, you can now type a partial pattern (e.g., `/f`) followed by a trigger key (`wildchar`) to open a **popup completion menu** showing all matching words. This offers two key benefits: 1. **Precision**: Select the exact word you're looking for without typing it fully. 2. **Memory aid**: When you can’t recall a full function or variable name, typing a few letters helps you visually identify and complete the correct symbol. --- **What’s New** Completion is now supported in the following contexts: - `/` and `?` search commands - `:s`, `:g`, `:v`, and `:vimgrep` ex-commands --- **Design Notes** - While `'wildchar'` (usually `<Tab>`) triggers completion, you'll have to use `<CTRL-V><Tab>` or "\t" to search for a literal tab. - **Responsiveness**: Search remains responsive because it checks for user input frequently. --- **Try It Out** Basic setup using the default `<Tab>` as the completion trigger: ```vim set wim=noselect,full wop=pum wmnu ``` Now type: ``` /foo<Tab> ``` This opens a completion popup for matches containing "foo". For matches beginning with "foo" type `/\<foo<Tab>`. --- **Optional: Autocompletion** For automatic popup menu completion as you type in search or `:` commands, include this in your `.vimrc`: ```vim vim9script set wim=noselect:lastused,full wop=pum wcm=<C-@> wmnu autocmd CmdlineChanged [:/?] CmdComplete() def CmdComplete() var [cmdline, curpos, cmdmode] = [getcmdline(), getcmdpos(), expand('<afile>') == ':'] var trigger_char = '\%(\w\|[*/:.-]\)$' var not_trigger_char = '^\%(\d\|,\|+\|-\)\+$' # Exclude numeric range if getchar(1, {number: true}) == 0 # Typehead is empty, no more pasted input && !wildmenumode() && curpos == cmdline->len() + 1 && (!cmdmode || (cmdline =~ trigger_char && cmdline !~ not_trigger_char)) SkipCmdlineChanged() feedkeys("\<C-@>", "t") timer_start(0, (_) => getcmdline()->substitute('\%x00', '', 'ge')->setcmdline()) # Remove <C-@> endif enddef def SkipCmdlineChanged(key = ''): string set ei+=CmdlineChanged timer_start(0, (_) => execute('set ei-=CmdlineChanged')) return key == '' ? '' : ((wildmenumode() ? "\<C-E>" : '') .. key) enddef **Optional: Preserve history recall behavior** cnoremap <expr> <Up> SkipCmdlineChanged("\<Up>") cnoremap <expr> <Down> SkipCmdlineChanged("\<Down>") **Optional: Customize popup height** autocmd CmdlineEnter : set bo+=error | exec $'set ph={max([10, winheight(0) - 4])}' autocmd CmdlineEnter [/?] set bo+=error | set ph=8 autocmd CmdlineLeave [:/?] set bo-=error ph& ``` closes: vim/vim#17570 https://github.com/vim/vim/commit/6b49fba8c8b97b178ddf81a9ca0c6f36c66f942f Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1200: cmdline pum not cleared for input() completion (#32879)zeertzjq2025-03-13
| | | | | | | | | | | | | Problem: Cmdline pum not cleared for input() completion. Solution: Temporary reset RedrawingDisabled in cmdline_pum_cleanup(), like what is done in wildmenu_cleanup() (zeertzjq). fixes: vim/vim#16874 closes: vim/vim#16876 https://github.com/vim/vim/commit/1830e787f6ee9828151284c44b494b801c677ee9 No code change is needed in Nvim, as RedrawingDisabled does not prevent the compositor from removing a grid.
* refactor(tests): use new-style highlight spec in legacy/bfredl2025-03-04
|
* vim-patch:9.1.0993: New 'cmdheight' behavior may be surprising #31892luukvbaal2025-01-06
| | | | | | | | | | | | | | | | | | | | | Problem: Although patch 9.1.0990 fixed a real problem/inconsistency, it also introduced new behavior that may break BWC and/or be unexpected. Before 9.1.0990, window commands could make the topframe smaller (without changing 'cmdheight'; quirk that is now fixed), but did not allow extending the topframe beyond the 'cmdheight' set by the user. After 9.1.0990, the user can reduce the 'cmdheight' below the value they set explicitly, through window commands, which may lead to confusion. (aftere v9.1.0990) Solution: Store the value explicitly set by the user and clamp the 'cmdheight' when resizing the topframe. This also applies to dragging laststatus, which in contrast to window commands _did_ allow reducing the 'cmdheight' to values below the one set by the user. So with this patch there is still new behavior, but I think in a way that is less surprising. While at it, also fix a Coverity warning, introduced in v9.1.0990 (Luuk van Baal) https://github.com/vim/vim/commit/c97e8695353565d6b20adffa48aad47f6e09967f
* vim-patch:9.1.0990: Inconsistent behavior when changing cmdheight (#31830)luukvbaal2025-01-05
| | | | | | | | | | | | | | | | Problem: Inconsistent behavior when changing cmdheight by resizing the topframe through wincmds and dragging laststatus. Changing cmdheight by resizing the topframe does not trigger OptionSet. Solution: Consolidate logic for changing the cmdheight, set the option value to handle side-effects (Luuk van Baal) https://github.com/vim/vim/commit/e15cbc1af47e9dea90448c714eb4908e5d4302fc vim-patch:9.0.0187: command line height changes when maximizing window height Problem: Command line height changes when maximizing window height. Solution: Do not change the command line height. (closes vim/vim#10885) https://github.com/vim/vim/commit/96bde99bf890acd9952863a02c1d15edca2000e1
* vim-patch:9.1.0890: %! item not allowed for 'rulerformat' (#31369)zeertzjq2024-11-28
| | | | | | | | | | | | | Problem: %! item not allowed for 'rulerformat' (yatinlala) Solution: also allow to use %! for rulerformat option (Yegappan Lakshmanan) fixes: vim/vim#16091 closes: vim/vim#16118 https://github.com/vim/vim/commit/ac023e8baae65584537aa3c11494dad6f71770af Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
* vim-patch:9.1.0855: setting 'cmdheight' may missing output (#31216)zeertzjq2024-11-15
| | | | | | | | | | | | Problem: setting 'cmdheight' may cause hit-enter-prompt and echo output to be missing Solution: Before cleaning the cmdline, check the need_wait_return flag (nwounkn) closes: vim/vim#13432 https://github.com/vim/vim/commit/2e48567007f2becd484a3c3dd0706bf3a0beeae7 Co-authored-by: nwounkn <nwounkn@gmail.com>
* 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.
* refactor(tests): use global defaults instead of set_default_attr_ids (2)bfredl2024-03-27
|
* refactor(tests): all screen tests should use highlightsbfredl2024-03-23
| | | | | | | | | | | | | | | | | | | | | | | This is the first installment of a multi-PR series significantly refactoring how highlights are being specified. The end goal is to have a base set of 20 ish most common highlights, and then specific files only need to add more groups to that as needed. As a complicating factor, we also want to migrate to the new default color scheme eventually. But by sharing a base set, that future PR will hopefully be a lot smaller since a lot of tests will be migrated just simply by updating the base set in place. As a first step, fix the anti-pattern than Screen defaults to ignoring highlights. Highlights are integral part of the screen state, not something "extra" which we only test "sometimes". For now, we still allow opt-out via the intentionally ugly screen._default_attr_ids = nil The end goal is to get rid of all of these eventually (which will be easier as part of the color scheme migration)
* test: rename (meths, funcs) -> (api, fn)Lewis Russell2024-01-12
|
* test: typing for helpers.methsLewis Russell2024-01-12
|
* test: do not inject vim module into global helpersLewis 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
* refactor(options): deprecate nvim[_buf|_win]_[gs]et_optionLewis Russell2023-05-21
| | | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: famiu <famiuhaque@protonmail.com>
* vim-patch:9.0.1461: ruler not drawn correctly when using 'rulerformat'Sean Dewar2023-04-17
| | | | | | | | | | | | | | | Problem: Ruler not drawn correctly when using 'rulerformat'. Solution: Adjust formatting depending on whether the ruler is drawn in the statusline or the command line. (Sean Dewar, closes vim/vim#12246) https://github.com/vim/vim/commit/fc8a601c3251c0388a88c1235b18c529385f7196 This issue was made apparent after neovim/neovim@0f1e2b6, as `showmode()` calls `win_redr_ruler()` with `curwin` now if it's floating, rather than the last window if there's no statusline (which usually already shares its right side with that of the editor). Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
* vim-patch:9.0.0670: no space for command line when there is a tabline (#20512)zeertzjq2022-10-06
| | | | | | Problem: No space for command line when there is a tabline. Solution: Correct computation of where the command line should be. (closes vim/vim#11295) https://github.com/vim/vim/commit/c9f5f73206272ccad0aa536854debc5f9781978a
* vim-patch:9.0.0665: setting 'cmdheight' has no effect if last window was ↵zeertzjq2022-10-06
| | | | | | | | resized (#20500) Problem: Setting 'cmdheight' has no effect if last window was resized. Solution: Do apply 'cmdheight' when told to. Use the frame height instead of the cmdline_row. (closes vim/vim#11286) https://github.com/vim/vim/commit/0816f473ab2f6cf7d8311c0f97371cada7f20d18
* feat(messages)!: graduate the 'msgsep' featurebfredl2022-10-05
| | | | | | | The old behaviour (e.g. via `set display-=msgsep`) will not be available. Assuming that messages always are being drawn on msg_grid (or not drawn at all, and forwarded to `ext_messages` enabled UI) will allows some simplifcations and enhancements moving forward.
* vim-patch:9.0.0517: when at the command line :redrawstatus does not work ↵zeertzjq2022-09-21
| | | | | | | well (#20266) Problem: When at the command line :redrawstatus does not work well. Solution: Only update the statuslines instead of the screen. (closes vim/vim#11180) https://github.com/vim/vim/commit/320d910064320f894a09ffdd1cd800ff5371e97f
* vim-patch:9.0.0512: cannot redraw the status lines when editing a commandzeertzjq2022-09-20
| | | | | | | Problem: Cannot redraw the status lines when editing a command. Solution: Only postpone the redraw when messages have scrolled. (closes vim/vim#11170) https://github.com/vim/vim/commit/c14bfc31d907cbee6a3636f780561ad1787cdb9b
* vim-patch:9.0.0507: cmdline cleared when using :redrawstatus in CmdlineChangedzeertzjq2022-09-20
| | | | | | | | | Problem: Command line cleared when using :redrawstatus in CmdlineChanged autocommand event. Solution: Postpone the redraw. (closes vim/vim#11162) https://github.com/vim/vim/commit/bcd6924245c0e73d8be256282656c06aaf91f17c Cherry-pick Test_redraw_in_autocmd() from Vim patch 8.2.4789.
* vim-patch:8.2.3102: test for crash fix does not fail without the fix (#20018)zeertzjq2022-08-31
| | | | | | | Problem: Test for crash fix does not fail without the fix. Solution: Adjust the test sequence. (closes vim/vim#8506) https://github.com/vim/vim/commit/3777d6e32b22f0a70b774760c24160079e303bad Cherry-pick CheckUnix from patch 8.2.1432.
* fix(redraw): handle switching to a tabpage with larger p_ch valuebfredl2022-08-29
|
* vim-patch:8.2.0911: crash when opening a buffer for the cmdline window failszeertzjq2022-08-25
| | | | | | | | | | Problem: Crash when opening a buffer for the cmdline window fails. (Chris Barber) Solution: Check do_ecmd() succeeds. Reset got_int if "q" was used at the more prompt. (closes vim/vim#6211) https://github.com/vim/vim/commit/9b7cce28d568f0622d77c6c9878c2d4770c3b164 Make code match latest Vim instead.
* vim-patch:9.0.0086: tabline is not redrawn when entering command linezeertzjq2022-07-27
| | | | | | Problem: Tabline is not redrawn when entering command line. Solution: Set "redraw_tabline". (closes vim/vim#10771) https://github.com/vim/vim/commit/6791adca53981666f0cf23e264e102b795224044
* fix(tests): update legacy tab switch test to be sanebfredl2022-04-05
|
* fix(ui): make window resize commands manage cmdheightFamiu Haque2022-04-05
| | | | Previously, the window resize commands did not resize the value of `cmdheight` when they caused a change in the topframe height, leaving a gap between the end of topframe and the start of the command line, this commit fixes that by making window resize commands automatically change the value of cmdheight if the resize affects the height of topframe.
* vim-patch:8.2.0131: command line is not cleared when switching tabsJan Edmund Lazo2020-10-29
Problem: Command line is not cleared when switching tabs and the command line height differs. Solution: Set the "clear_cmdline" flag when needed. (Naruhiko Nishino, closes vim/vim#5495) https://github.com/vim/vim/commit/479950f6c9aee4806f28a2b2fe5471e18a034cff