aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/popupmenu_spec.lua
Commit message (Collapse)AuthorAge
* fix(options): extend dry-run validationLewis Russell5 days
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: nvim_set_option_value() dry runs skip checks in did_set_* callbacks. This logic also prepares values needed to apply the option, such as tab widths or a compiled regexp. Moving the checks into validation callbacks needs a way to save that work for did_set_*. Solution: Store prepared values in optset_T so did_set_* can consume them after the option is stored. Dry runs perform the same validation, then free the prepared values without changing live state. This extends dry-run validation for: - 'cedit': reject invalid command-line window keys. - 'completeitemalign': require each completion column exactly once. - 'cursorlineopt': reject empty values and conflicting line modes. - 'encoding': accept only UTF-8 and its aliases. - 'fileencoding': reject lists and local changes with 'nomodifiable'. - 'messagesopt': require mandatory fields and enforce numeric limits. - 'spellcapcheck': return regexp errors, including under :silent!. - 'spellsuggest': reject conflicting suggestion modes. - 'varsofttabstop' and 'vartabstop': reject invalid tab widths. - 'wildmode': reject more than four completion stages. 'makeencoding' also uses the shared encoding preparation. Separating value preparation exposed a bug in 'vartabstop' and 'varsofttabstop': failed assignments could discard local tab widths, and global assignments could overwrite them. Fix this by preparing new widths separately and applying them only after a valid local assignment. AI-assisted
* 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`.
* feat(cmdwin): implement cmdwin as a normal buf+winJustin M. Keyes2026-06-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: cmdwin (the `:q` cmdline buffer) has various limitations which require special-casing all over the codebase. Besides complicating the code, it also breaks async plugins if they try to create buffers/windows after some work is done, if the user happens to open cmdwin at the wrong the moment: Lua callback: …/guh.nvim/lua/guh/util.lua:531: E11: Invalid in command-line window; <CR> executes, CTRL-C quits stack traceback: [C]: in function 'nvim_buf_delete' …/guh.nvim/lua/guh/util.lua:531: in function <…/guh.nvim/lua/guh/util.lua:526> Solution: Just say no to "inception". Reimplement cmdwin as a normal buffer+window. All of the cmdwin contortions (in both core, and innocent plugins) exist literally only to support "inception": recursive cmdwin-in-cmdline-things, like `<c-r>=`, `/`, search-during-substitute, `:input()`, etc. So we just won't support that (though I have a potential plan for that later, which I call "modal parking lot"). The benefit is that plugins, and core, no longer have to care about cmdwin. BONUS: - mouse-drag on vertical separators works (it only worked for horizontal/statusline before) - inccommand-in-cmdwin now works correctly, for free (thus don't need #40077). POTENTIAL FOLLOWUPS - Drop `CHECK_CMDWIN` ("E11: Invalid in command-line window"), allow chaos. - Unify `BUFLOCK_OK` / `LOCK_OK` ? DESIGN: - Eliminate lots of C globals, `EX_CMDWIN`, etc. - `text_locked()` no longer reports true for cmdwin. - cmdwin = a normal window with 'winfixbuf', 'bufhidden=wipe', 'buftype=nofile'. Invariants come from those options rather than special cases throughout the codebase. - `nv_record` for q:/q//q? calls Lua `nlua_call_vimfn("vim._core.cmdwin", …)`. No `K_CMDWIN` / cmdline-reader detour. - `cedit_key` (`c_CTRL-F`) schedules a deferred event that calls `vim._core.cmdwin.open(type, content, pos)` and returns `Ctrl_C` so the in-flight cmdline cancels. Reader state is not serialized; instead the captured `(type, line, col)` is replayed via `nvim_feedkeys(type..line.."<CR>", "nt", …)` after user confirms. - On confirm/cancel: `<CR>` / `<C-C>` calls into Lua which closes the window and re-feeds the cmdline. BREAKING CHANGES: - Expression-register cmdline (`<C-R>=` from insert-mode) no longer supports cmdwin. Same applies to `input()` / `inputlist()` (already covered by `text_locked`). - Usage of cmdwin in macros/mappings will probably break (assuming they ever worked).
* vim-patch:9.2.0707: completion: popup misplaced when text before it is ↵zeertzjq2026-06-23
| | | | | | | | | | | | | | | | | | concealed (#40374) Problem: When the cursor line has concealed text before the start of the completion, the insert-mode completion popup is drawn at the wrong screen column and the cursor no longer lines up with the completed text. Solution: Record the concealed width before the cursor on its screen line in a new `win_T` field while `win_line()` draws it, subtract it in `pum_display()` to place the menu over the visible text, and redraw the cursor line so `win_line()` corrects the cursor too. closes: vim/vim#20539 https://github.com/vim/vim/commit/d167c50de4b954e5ddd97208187c5b3b77dd89cc Co-authored-by: Barrett Ruth <br@barrettruth.com>
* vim-patch:9.2.0682: Wrong dot-repeat when calling complete() while filtering ↵zeertzjq2026-06-21
| | | | | | | | | | | | | completion (#40350) Problem: Wrong dot-repeat when calling complete() while filtering Ctrl-N completion. Solution: Also check compl_started for whether completion is active. (zeertzjq) related: neovim/neovim#40346 closes: vim/vim#20595 https://github.com/vim/vim/commit/37a7e4944f9ef61cfc9c3dd30f76ab130948c2ef
* vim-patch:9.2.0596: cmdline completion popup cannot be scrolled with the ↵zeertzjq2026-06-08
| | | | | | | | | | | | | | | | | | | mouse (#40142) Problem: In command-line completion with a popup menu ('wildoptions' contains "pum"), the info popup shown next to the menu could not be scrolled, unlike the Insert mode completion info popup which scrolls with the mouse wheel. Solution: When the mouse pointer is on top of the info popup, scroll it with the mouse wheel in command-line mode as well, without closing the completion popup menu. closes: vim/vim#20146 closes: vim/vim#20418 https://github.com/vim/vim/commit/96dbab257a881ee4a552e1acf62e7d4168dc444a Co-authored-by: Hirohito Higashi <h.east.727@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* vim-patch:9.2.0454: tests: no test that "abbr" in customlist completion is shownzeertzjq2026-05-09
| | | | | | | | | Problem: No test that "abbr" in customlist completion is shown in pum. Solution: Add some "abbr" fields to the existing test (zeertzjq). closes: vim/vim#20165 https://github.com/vim/vim/commit/b207b5a2a38dd8f45417e69c2e659c4c05ad3c1e
* vim-patch:9.2.0451: 'findfunc' can't return extra info for cmdline completionzeertzjq2026-05-09
| | | | | | | | | | | | Problem: 'findfunc' can't return extra info for cmdline completion (Maxim Kim). Solution: Handle 'findfunc' return value in cmdline completion like that of "customlist" functions (zeertzjq). fixes: vim/vim#20155 closes: vim/vim#20158 https://github.com/vim/vim/commit/58124789aaf98fd96cd94a738633fd652a5e079a
* vim-patch:9.2.0442: completion: i_CTRL-X_CTRL-V doesn't use dict from ↵zeertzjq2026-05-05
| | | | | | | | | | | | customlist (#39614) Problem: Completion with i_CTRL-X_CTRL-V doesn't use dict from cmdline "customlist" completion. Solution: Include abbr/kind/menu/info in the completion items (zeertzjq). closes: vim/vim#20139 https://github.com/vim/vim/commit/2bfddbea47e1afa79ecd094040418abdba88bc83
* vim-patch:9.2.0439: completion: info popup not removed in cmdline mode (#39595)zeertzjq2026-05-04
| | | | | | | | | | | | Problem: Info popup isn't removed when selecting an item that doesn't have "info" in cmdline completion, which is inconsistent with Insert mode behavior. Solution: Set pum_call_update_screen in cmdline mode (zeertzjq). closes: vim/vim#20128 https://github.com/vim/vim/commit/3bfffcc29054faff2dbec2d765317ee09e9ef827 Nvim already behaves correctly. Add a screen test as there are none.
* vim-patch:9.2.0346: Wrong cursor position when entering command line window ↵zeertzjq2026-04-15
| | | | | | | | | | | | | | | | | | | | | | | | | (#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>
* fix(pum): info float width grows on reselect with 'linebreak' #38680glepnir2026-04-12
| | | | | | | Problem: win_linetabsize() includes wrap overhead from 'linebreak' based on current window width, but the result sizes the window, causing a feedback loop. Solution: Temporarily set w_view_width to Columns before measuring.
* fix(pum): crash with 'pumborder' and wide item (#38852)glepnir2026-04-08
| | | | | | Problem: pum_col goes negative when item width + border exceeds screen. Solution: account for border_width in pum_compute_horizontal_placement() instead of adjusting pum_col after the fact
* refactor(test): clean up pumborder round test cases #38368glepnir2026-03-20
| | | | | Problem: pumborder round tests contained redundant. Solution: Remove unnecessary test code.
* fix(ui): apply 'pumborder' to mouse menu, fix overflow #36193glepnir2026-03-19
| | | | | | | | | | | Problem: Mouse popup menus (right-click context menus) do not respect the 'pumborder' option and could overflow screen boundaries when borders were enabled near the edge. Solution: - Remove the mouse menu exclusion from border rendering. - Add boundary check to shift menu left when border would exceed screen width, ensuring complete visibility of menu content and borders.
* fix(api): use standard error messagesJustin M. Keyes2026-03-16
|
* fix(ui): preview float doesn't respond to mouse scroll #38270glepnir2026-03-13
| | | | | | | Problem: The floating preview window (e.g. completion info) has mouse=false, so scroll wheel events pass right through it. Solution: Set mouse=true on the preview float so users can scroll its content with the mouse wheel.
* fix(pum): keep info window aligned with pum when above #38251glepnir2026-03-12
| | | | | | | | | | Problem: When `pum_above` is set, the info window uses `anchor=SW`. Updating the info window height during `CompleteChanged` causes its top edge to shift, so it no longer aligns with the top of the pum. Solution: Use `NW` as the anchor even when `pum_above` is true so the info window remains aligned with `pum_row`.
* fix(pum): separate scrollbar from shadow border (#37448)glepnir2026-01-19
| | | | | | | | | | Problem: With shadow border, scrollbar and border overlap. Shadow's right border starts from the second row (offset by 1), but scrollbar renders on every row including the first. If they share a column, the first row shows scrollbar where shadow hasn't started yet, causing misalignment. Solution: Separate scrollbar from the shadow's right border.
* fix(pum): text overflows into border on truncation (#37438)glepnir2026-01-18
| | | | | | | | | Problem: When text is too long, it overflows into the border. This happens because grid_line_maxcol includes border columns, so grid_line_puts can write there. Solution: Truncate string to available width when need_fcs_trunc is set.
* fix(completion): set 'wrap' and scrolloff=0 in preview window (#37327)glepnir2026-01-10
| | | | | | | | Problem: info/preview floating windows are created without wrap enabled, causing info text to be truncated. Solution: enable 'wrap' and set 'scrolloff' to 0 by default, like vim's popup_create does.
* fix(pum): pumborder=shadow not blending properly (#37328)zeertzjq2026-01-09
| | | | | Problem: Setting pumborder=shadow doesn't blend proerly. Solution: Check fconfig.shadow when setting pum_grid.blending, like what is done in check_blending().
* fix(pum): hide info floating window when insufficient space (#37107)glepnir2025-12-27
| | | | | | | | | | | | fix(pum): hide info window when insufficient space Problem: 1. Info window was displayed even with insufficient space. 2. Tab characters counted as single cells. Solution: 1. Hide window when space < 10 columns. Will be configurable via completepopup width option in the future. 2. Use win_linetabsize over mb_string2cells.
* fix(pum): adjust info window column offset when scrollbar is present (#37069)glepnir2025-12-26
| | | | | | | | | Problem: When the popupmenu has no border but includes a scrollbar, the info window column is misaligned due to a missing column offset. Solution: Apply a one-column offset to the info window when the popup menu has no border and a scrollbar is present.
* vim-patch:9.1.1930: completion: 'completefuzzycollect' is too obscurezeertzjq2025-11-28
| | | | | | | | | | | | | | | | Problem: completion: 'completefuzzycollect' option is too obscure Solution: Deprecate the option, but don't error out for existing scripts, behave like 'completefuzzycollect' is set when fuzzy completion is enabled (Girish Palya). fixes: vim/vim#18498 closes: vim/vim#18788 https://github.com/vim/vim/commit/33fbfe003c17ad25bf3903aaa89a55fe372086ba Remove this option completely, as it's introduced in Nvim v0.12 cycle. Co-authored-by: Girish Palya <girishji@gmail.com>
* fix(pum): crash when resizing grid with pumborder set (#36404)glepnir2025-11-10
| | | | | | Problem: Grid size check didn't account for border_width, causing row index out of bounds when drawing bordered popup menu. Solution: Check grid.rows against pum_height + border_width.
* feat(ui): overlay scrollbar on 'pumborder' #36273glepnir2025-10-23
| | | | | | | Problem: When pumborder is set, the scrollbar still occupies a column on the screen, wasting a 1 column of space. Solution: Render the scrollbar on the right/left (rl mode) side of the border when pumborder is set.
* fix(pumborder): wrong layout with pumborder=none #36208glepnir2025-10-20
| | | | | | | | | | | | Problem: Border width calculations were scattered with repeated `*p_pumborder != NUL ? 2 : 0` patterns. The "none" value was not consistently checked, causing borders to appear when pumborder="none". When "shadow" the info floating window have an extra cell of spacing. Solution: Add `pum_border_width()` helper that returns 0 when pumborder is unset or "none" (opt_winborder_values[7]), returns 1 when pumborder is shadow, otherwise return 2.
* fix(pumblend): do not apply special highlight attrs from bg layer #36186Tomasz N2025-10-14
| | | | | | | | | | Problem: if pumblend >= 50, non-whitespace menu character gets italic, bold, underline (or similar) attribute from the cell underneath, which is not really useful and can't be "blended". Solution: drop highlight combination for that special case (@zeertzjq on #36133). Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* fix(ui): 'pumborder' parsing, shadow #36127glepnir2025-10-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: 1. Setting `pumborder=+,+,+,+,+,+,+,+` failed to render the custom border characters correctly. The issue occurred in `parse_winborder()` where it incorrectly used `p_winborder` instead of the `border_opt` parameter when the option value didn't contain commas. 2. In `pum_redraw()`, calling `parse_border_style()` directly with the option string failed to parse comma-separated border characters. 3. Missing documentation for PmenuShadow and PmenuShadowThrough highlight groups used by the shadow border style. 4. Coverity reports CID 631420: passing WinConfig (480 bytes) by value in `grid_draw_border()`. 5. crash when using `shadow` value on pumborder. Solution: 1. Fix `parse_winborder()` to use `border_opt` parameter consistently, ensuring the correct option value is parsed regardless of which option (winborder/pumborder) is being set. 2. Update `pum_redraw()` to call `parse_winborder()` instead of `parse_border_style()`, properly handling both predefined styles and custom comma-separated border characters. 3. Add documentation for PmenuShadow (blended shadow areas) and PmenuShadowThrough (see-through corners) highlight groups. 4. Change `grid_draw_border()` to accept WinConfig by pointer. 5. When the "shadow" style is used, no additional row and column offset is applied, and the border width is reduced.
* feat(ui): 'pumborder' (popup menu border) #25541glepnir2025-10-10
| | | | | | | | | Problem: Popup menu cannot have a border. Solution: Support 'pumborder' option. Generalize `win_redr_border` to `grid_redr_border`, which redraws border for window grid and pum grid.
* 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>
* feat(ui): support grid=0 in nvim_input_mouse #32535fredizzimo2025-09-13
| | | | | | | | | | | | | | | | | Problem: Multigrid UIs have to find out which window to send the input by using the Nvim focus rules, which are not fully documented. Furthermore,`getmousepos()` has several problems when multigrid is enabled, with the main one being that screenrow and screencol are window relative instead of screen relative, due to the fact that the UI don't send any absolute coordinates. Solution: Allow passing 0 as grid to `nvim_input_mouse`, with absolute coordinates, which lets nvim determine the actual window to send the mouse input to. This works as long as nvim is in charge of the window positioning. If the UI repositions or resizes the windows, it can still pass the grid it determines like before.
* test: add tests for #20348zeertzjq2025-09-08
|
* vim-patch:9.1.1740: Memory leak with wildmode=longest,full and wildoptions=pumzeertzjq2025-09-08
| | | | | | | | | | | | | Problem: Memory leak with wildmode=longest,full and wildoptions=pum (after 9.1.1737). Solution: Avoid using showmatches() and WILD_NEXT together. Also fix wildmode=longest,noselect:full selecting wrong item (zeertzjq). fixes: vim/vim#18228 closes: vim/vim#18229 https://github.com/vim/vim/commit/c7f235bd432c0a7500ae39acdad7d63a614a1b33
* vim-patch:9.1.1739: Matches may be listed twice with wildmode=longest,listzeertzjq2025-09-08
| | | | | | | | | | | Problem: Matches may be listed twice with wildmode=longest,list when "longest" doesn't change command line (after 9.1.1737). Solution: Set did_wild_list when trying "list" after "longest" (zeertzjq). closes: vim/vim#18227 https://github.com/vim/vim/commit/a28a2eb9d9362adb1c7f9ebde66cd1329dd463bb
* vim-patch:9.1.1737: Patch v9.1.1714 introduce a regression for wildmenuzeertzjq2025-09-08
| | | | | | | | | | | | | | | Problem: Patch v9.1.1714 introduce a regression for wildmenu (zeertzjq) Solution: Restore behavior of "longest" in 'wildmode' (Girish Palya) - Fixed a regression caused by PR vim/vim#18125 selecting wrong item - Fixed another regression where the first pasted text did not appear on the command-line after starting Vim. closes: vim/vim#18212 https://github.com/vim/vim/commit/8fec92d631cf9d852ad794863721c2710ee2ff9e 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
* fix(ui): check for cmdline mode properly (#35202)zeertzjq2025-08-07
|
* test(screen): remove screen:get_default_attr_ids() (#34973)luukvbaal2025-07-17
| | | | | | | Problem: get_default_attr_ids() is used to get and change a subset of the current highlight definitions in {fold,popupmenu}_spec.lua, for which we have add_extra_attr_ids(). Solution: Use global highlight definitions and use add_extra_attr_ids to replace.
* vim-patch:9.1.1521: completion: pum does not reset scroll pos on reopen with ↵zeertzjq2025-07-08
| | | | | | | | | | | | | | | | | | | | | 'noselect' (#34836) Problem: When 'wildmode' is set to include "noselect", the popup menu (pum) incorrectly retained its scroll position when reopened. This meant that after scrolling down through the menu with `<C-n>`, reopening the menu (e.g., by retyping the command and triggering completion again) would show the menu starting from the previously scrolled position, rather than from the top. This could confuse users, as the first visible item would not be the first actual match in the list. Solution: Ensure that the popup menu resets its scroll position to the top when reopened (Girish Palya). closes: vim/vim#17673 https://github.com/vim/vim/commit/0cd7f3536bde47cf9693090b839abf88c7f019c8 Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1454: tests: no test for pum at line break position (#34462)zeertzjq2025-06-12
| | | | | | | | | | | Problem: Missing test case for pum display on a wrapped line. Solution: Add a test case to cover pum behavior at line break positions. (glepnir) closes: vim/vim#17520 https://github.com/vim/vim/commit/6cc9bd400192470cd8521fdde6b3d8a0d2e43111 Co-authored-by: glepnir <glephunter@gmail.com>
* test: remove unnecessary line breaks #34369glepnir2025-06-08
| | | | Problem: The test included too many unnecessary line breaks. Solution: Remove the extra line breaks to make the test code more concise.
* vim-patch:9.1.1398: completion: trunc does not follow Pmenu highlighting ↵zeertzjq2025-05-19
| | | | | | | | | | | | | | | attributes (#34084) Problem: When items are combined with user-defined highlight attributes (e.g., strikethrough), trunc inherits these attributes, making the text difficult to read. Solution: trunc now uses the original Pmenu and PmenuSel highlight attributes (glepnir) closes: vim/vim#17340 https://github.com/vim/vim/commit/0816f17e9a2ba2d1e132497b03905878c7340a78 Co-authored-by: glepnir <glephunter@gmail.com>
* test(pum): check RightRelease in outside pum with winbar (#33640)zeertzjq2025-04-26
|
* test(pum): fix passing incorrect grid (#33635)zeertzjq2025-04-25
|
* test(pum): remove two more duplicate screen states (#33628)zeertzjq2025-04-25
|
* fix(pum): handle RightDrag on parent grid properly (#33626)zeertzjq2025-04-25
|
* feat(options): default statusline expression #33036Shadman2025-04-21
| | | | | |