aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_extui.lua
Commit message (Collapse)AuthorAge
* refactor: rename _extui => _core.ui2 #37692luukvbaal2026-02-05
| | | | | | | Problem: _extui module name is confusing and should eventually end up in _core/. Solution: Move it there and name it ui2.
* fix(ui): only internal messages are unsafe #37462luukvbaal2026-01-26
| | | | | | | | Problem: Fast context for msg_show event inhibits vim.ui_attach from displaying a stream of messages from a single command. Solution: Remove fast context from msg_show events emitted as a result of explicit API/command calls. The fast context was originally introduced to prevent issues with internal messages.
* fix(ui2): only redraw when necessary #36457luukvbaal2025-11-17
| | | | | | Problem: Until now the UI callback called nvim__redraw() liberally. It should only be needed when Nvim does not update the screen in its own event loop. Solution: Identify which UI events require immediate redrawing.
* fix(ui): cmdline_show is not fired after clearing the screen (#36451)luukvbaal2025-11-08
| | | | | | | | | | | | Problem: Resize events during startup may clear an active external cmdline, which is then not redrawn. UI2 VimResized autocommand does not work. UI2 message appearance may be altered by inherited window options. The message separator uses the wrong fillchar. Solution: Unset cmdline_was_last_redrawn when clearing the screen, such that cmdline_show is re-emitted. Ensure set_pos function is called without arguments. Ensure such options are unset. Use 'fillchars'->msgsep.
* fix(extui): check if buffers/windows exist before deleting (#34886)Tomasz N2025-07-11
| | | | Problem: Disabling vim._extui may try to delete non-existent windows/buffers. Solution: Check that window/buffer is valid before deleting.
* test(ui/{cmdline,message}2_spec): reduce flakiness/runtime #34875luukvbaal2025-07-10
| | | | | | | | Problem: Storing the configured 'cmdheight' value is scheduled and may happen after cmdline2_spec already entered block_mode. Excessive wait time for expected screen state due to delayed ruler after an error message. Solution: Only schedule storing the user configured 'cmdheight' if v:vim_did_enter is unset. Use regular message instead of error.
* feat(extui): use winborder for msg window #34859Sebastian Lyng Johansen2025-07-09
| | | | | | | | | | | Problem: The message window is essentially a regular floating window but does not use 'winborder'. Still some "scratch" buffer options unset after it was removed from its window. Solution: Do not set the border when opening the window message. Forego passing `scratch = true` when opening a buffer, set the options manually when necessary. Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
* perf(extui): delay creating windows, buffers and parser (#34665)luukvbaal2025-06-27
| | | | | | | | | | Problem: vim._extui unconditionally creates windows, buffers and the Vimscript cmdline highlighter when it is first loaded. Solution: Schedule first creation of the window so that first redraw happens sooner (still need to create at least the cmdline window asap as it can have a different highlight through hl-MsgArea; thus further delaying until the first event that needs a particular target seems redundant). Load the cmdline highlighter on the first cmdline_show event.
* fix(extui): clear cmdline buffer for first message (#34490)luukvbaal2025-06-15
| | | | | | | | | | | | | | | | | Problem: Cmdline buffer is not cleared for a new message (since c973c7ae), resulting in an incorrect spill indicator. When the cmdline buffer is cleared, "msg_row" is not invalidated, resulting in an error. The extui module is untested. Return value of `vim.ui_attach()->callback` is undocumented. Solution: Clear the cmdline buffer for the first message in an event loop iteration. Ensure msg_row passed as end_row does not exceed buffer length. Add `messages_spec2.lua` to test the extui module, keeping in mind that test coverage will greatly increase if this UI is made the default. As such, only tests for specific extui functionality unlikely to be covered by tests leveraging the current message grid. Document the return value of `vim.ui_attach()->callback`, it seems to make sense, and is also used to suppress remote UI events in `messages_spec2.lua`.
* docs(extui): rename box->msg, more->pager, prompt->dialogLuuk van Baal2025-06-13
| | | | | Includes breaking changes to the `opts` layout. "box" doesn't really describe anything other than a floating window so was an unwanted synonym.
* fix(extui): use visible to determine active "more" (#34327)luukvbaal2025-06-06
| | | | | | | | | | | Problem: Current window is checked to determine whether "more" window is open. Making it the current window is scheduled in case the cmdwin is open so this can be too late. "cmdline_hide" may be emitted when the topline is temporarily invalid (after incsearch->restore_viewstate()). Solution: Use the window visibility to determine an active "more" window instead. Don't nvim__redraw->flush the "cmdline_hide" event (a normal will already happen).
* fix(extui): copy window config to new tabpage (#34308)luukvbaal2025-06-04
| | | | | | | | | Problem: When opening a new tabpage, extui windows are initialized with their default config. Window visiblity/dimensions on other tabpages may get out of sync with their buffer content. Solution: Copy the config of the window to the new tabpage. No longer keep track of the various windows on each tabpage. Close windows on inactive tabpages instead (moving them could be more efficient but is currently not supported in the API).
* fix(extui): adjust "more" window routing (#34251)luukvbaal2025-06-01
| | | | | | | | | | | | | Problem: Message lines from multiple message events that end up spilling 'cmdheight' end up spread out over the cmdline and "more" window. Messages emitted as feedback to a typed :command (rather than its sole purpose like :echo/:=) are routed to the more window. The more window isn't closed when entering the cmdwin, and doesn't allow `vim.hl.on_yank()`. Solution: When first opening the "more" window for spilled messages, move the message buffer to the more window. Restrict routing of typed commands to echo kinds. Ignore all events but WinLeave and TextYankPost.
* revert: show "g<" hint when message spills 'cmdheight'Luuk van Baal2025-05-14
| | | | | | | Problem: Hint message to press "g<" for message that spills 'cmdheight' is too intrusive. Solution: Remove the hint message. Document the meaning of the spill indicator instead.
* feat(extui): assign 'filetype' to extui windows (#33924)luukvbaal2025-05-09
| | | | | | | | | Problem: Unable to discern windows used by the extui interface to configure their local options. 'winblend' may be detrimental to legibility depending on the colorscheme and 'background'. Solution: Assign the "cmdline", "msgmore", "msgprompt" and "msgbox" 'filetype' to the respective windows. Don't set 'winblend' for the message "box" window.
* fix(extui): route interactive messages to more-window (#33885)luukvbaal2025-05-09
| | | | | | | | | | | Problem: Extui does not route messages emitted as a result of a typed command to the "more" window. Command message leading shell messages is missing a kind. Messages not routed to 'cmdheight' area after it was 0. Solution: Route messages that were emitted in the same event loop as an entered command to the "more" window. Also append multiple messages in an already open more-window. Assign it the `shell_cmd` kind. Change message position when 'cmdheight' changes from 0.
* fix(extui): "box" window width calculated on last line (#33881)luukvbaal2025-05-07
| | | | | | | | | Problem: The "box" window width is calculated on the last line when applying "last" virt_text. There may be longer lines part of the same message. Solution: Don't decrease box width if the calculated width is smaller. Minor unrelated changes. Co-authored-by: Eike <eike.rackwitz@mail.de>
* fix(extui): hide inactive "more" window (#33831)luukvbaal2025-05-04
| | | | | Problem: More-window is left visible after leaving it. Cursor may be hidden behind it and it is hard to re-enter afterwards. Solution: Close the more-window when another window is entered.
* fix(extui): search highlighting in extui "more" pager #33792luukvbaal2025-05-03
| | | | Problem: No search highlighting in extui "more" pager window. Solution: Only use custom highlight namespace in cmdline window.
* fix(extui): check option values after VimEnter (#33768)luukvbaal2025-05-02
| | | | | | Problem: Not picking up configured option values when enabling _extui after startup. Solution: Check option values when enabing _extui. Fix https://github.com/neovim/neovim/issues/33767
* feat(ui): ext_cmdline/messages for the TUI #27855luukvbaal2025-05-02
Problem: We have an unmaintained Vimscript parser and cmdline highlighting mechanism, with which it is hard to leverage the treesitter highlighter. Long messages result in a hit-enter-prompt. Solution: Implement a vim.ui_attach() UI, that replaces the message grid (orphaning some 3000+ LOC core C code). Introduce an experimental vim._extui module, because removing the message grid at the same time is too risky. The new UI leverages the bundled treesitter highlighter and parser for Vimscript, as well as the matchparen plugin, to highlight the cmdline. Messages are truncated in the cmdline area, or placed in a floating message box in the bottom right corner. Special ("list_cmd") messages and the message history are shown in a, "more prompt" (now a fully interactive regular window). Various default UI elements ('showcmd', 'ruler') are also placed in the cmdline area, as virtual text. `require('vim._extui').enable({})` enables the experimental UI. `{ msg.pos = 'box' }` or `:set cmdheight=0` enables the message box variant. Followup: - Come to a consensus for how best to represent messages (by default). - Start removing message grid when this is deemed a successful replacement. When that is finished, make this new UI the default and update a lot of tests.