aboutsummaryrefslogtreecommitdiff
path: root/test/functional/editor/cmdwin_spec.lua
Commit message (Collapse)AuthorAge
* fix(cmdwin): handle UTF-8 characters containing 0x80 #41566Aryan Pandey2026-08-31
| | | | | | | | Problem: Confirming cmdwin with a UTF-8 character containing 0x80 does not complete the command. Solution: Escape K_SPECIAL bytes while feeding the cmdwin input after confirmation.
* fix(cmdwin): allow a user to switch to other buffers #41199Rob Pilling2026-08-28
|
* fix(cmdwin): q: in visual-mode does not insert visual range #40973mityu2026-07-25
| | | | | | | Problem: `q:` in visual mode does not insert `'<,'>` automatically in the current line on cmdwin. Solution: Insert `'<,'>` in the current line on cmdwin when `q:` is used in visual mode.
* 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`.
* fix(cmdwin): handle control characters properly #40488zeertzjq2026-06-30
| | | | | - Replace newlines in the current cmdline with NULs when opening cmdwin, and do the reverse when putting a cmdwin line back into the cmdline. - Escape control characters with Ctrl-V when feeding cmdline.
* test(editor/cmdwin_spec): check that Ctrl-C puts line in cmdline (#40487)zeertzjq2026-06-30
|
* fix(cmdwin): handle split/tabpageJustin M. Keyes2026-06-29
| | | | | | | | | | | | Problem: - If cmdwin window is split, ENTER in one does not close the others. - If cmdwin is put into a different tabpage via <c-w>T, it stops working (ENTER does not execute the cmd). Solution: - Close the buffer instead of the window. - In the WinClosed handler, skip `M._cleanup()` unless this is the last cmdwin window.
* fix(cmdwin): do not block WinEnter events on close #40449Evgeni Chasnovski2026-06-27
| | | | | Problem: manual closing cmdwin blocks some events. Solution: use `nested=true` in buffer-local `WinClosed` event.
* fix(cmdwin): set 'buflisted'Justin M. Keyes2026-06-26
| | | | | | | | | | | | | | Problem: Legacy cmdwin set 'buflisted', but new one doesn't. https://github.com/neovim/neovim/issues/40431#issuecomment-4811593353 'buflisted' useful for: - "bufferline" style tablines, they usually show only listed buffers. - some automatic actions can be conditioned on whether a buffer is listed; 'buflisted' signals that the buffer is "important enough". Solution: Set 'buflisted'.
* fix(cmdwin): implement Enter/Ctrl-C as builtinsJustin M. Keyes2026-06-26
| | | | What echasnovski wants, echasnovski gets.
* fix(cmdwin): space in cmdwin-char 'statuscolumn'Justin M. Keyes2026-06-26
| | | | | To match the old behavior, the cmdwin-char should not be followed by a space char.
* fix(cmdwin): duplicate line in historyJustin M. Keyes2026-06-26
| | | | | | | | | Problem: After ctrl-f from the cmdline, the last 2 lines of cmdwin are redundant. Solution: In `open_cmdwin`, clear the live cmdline so that unwinding it (via Ctrl_C) does not add it to history.
* fix(ui2): "msg_history_show" error while in cmdwinJustin M. Keyes2026-06-25
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Executing :messages while in cmdwin fails: Error in "msg_history_show" UI event handler (ns=nvim.ui2): Lua: …/_core/ui2/messages.lua:699: Invalid 'height': expected positive Integer stack traceback: [C]: in function 'nvim_win_set_config' …/_core/ui2/messages.lua:699: in function 'set_pos' …/_core/ui2/messages.lua:329: in function 'set_target_pos' …/_core/ui2/messages.lua:389: in function 'show_msg' …/_core/ui2/messages.lua:553: in function 'handler' …/_core/ui2.lua:161: in function 'ui_callback' …/_core/ui2.lua:210: in function <…/_core/ui2.lua:202> The bug: when `texth.all` is small (e.g. 0 from a hidden pager whose new content isn't laid out yet), or when the available height after subtracting the cmdwin is small, `math.min(min, …)` can yield 0, and `nvim_win_set_config` rejects `height=0`. Solution: Floor at 1.
* 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).