aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_extui
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(ui2): only copy highlight marks when expanding cmdline #37709luukvbaal2026-02-04
| | | | Problem: Error copying over multi-line message span marks to expanded cmdline. Solution: Only copy over the highlight marks as intended.
* feat(ui2): replace message by its ID #37672luukvbaal2026-02-04
| | | | | | | Problem: UI2 does not implement the msg_show event msg_id parameter. Solution: Store message IDs currently shown in the cmd/msg buffers. Set extmarks spanning the message which are used to replace a still visible message when a new message with the same ID is received.
* fix(ui2): don't adjust dialog pos for pum wildmenu (#37695)Sean Dewar2026-02-04
| | | | Problem: Dialog position unnecessarily adjusted for pum wildmenu. Solution: Apply no offset if the pum is visible.
* fix(ui2): wildmenu hidden behind dialog window #37684luukvbaal2026-02-03
| | | | | | | Problem: The wildmenu is hidden behind the dialog window with "list" in 'wildmode'. Global ('laststatus' set to 3) statusline is hidden behind the pager window. Solution: Check wildmenumode() to adjust the dialog position when necessary. Ensure pager is positioned above the global statusline with 'laststus' set to 3.
* fix(ui2): callbacks reference stale message-window handles #37673luukvbaal2026-02-02
| | | | | Problem: Scheduled callbacks reference potentially outdated window handles e.g. after switching tabpage. Solution: Use ext.wins which stores the updated window handles.
* 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): unset Search highlighting (#36633)Oleh Volynets2025-11-20
| | | | | | | | | | | Problem: Trying to match the search highlight groups to the Normal highlight for the window can fail when the message highlighting contains a fg/bg that the Normal highlight doesn't (like an error message in cmd will have ErrorMsg highlight instead of MsgArea - which is Normal in cmd.) Solution: Link the search highlight groups to an empty group in 'winhighlight' thus disabling them instead of overriding them with Normal/MsgArea/etc.
* fix(ui2): hide search highlights in msg window #36626luukvbaal2025-11-19
| | | | | | fix(ui2): hide search highlights in msg window. Problem: Search highlighting is shown in the msg (and dialog) window. Solution: Hide search highlighting in all but the pager window.
* 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(ui2): emit FileType event after setting default pager options #36315yilisharcs2025-10-27
| | | | | | | | | | Problem: Setting a filetype before configuring default options for ui2 buffers (pager, cmd, ...) prevents users from setting their own options. Solution: Call nvim_set_option_value after defaults are set. Closes #36314 Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
* fix(ui2): start treesitter after deleting cmdline buffer (#36274)luukvbaal2025-10-22
| | | | Problem: Treesitter is not started in new cmdline buffer after deletion. Solution: Start treesitter when highlighter buffer no longer matches.
* fix(ui2): don't scroll beyond eob in dialog window #36116luukvbaal2025-10-10
| | | | Problem: Forward page scrolling reveals eob lines in the dialog window. Solution: Check if the end of the buffer is visible before scrolling down.
* fix(extui): setup buffers after activating `eventignorewin` (#35915)Tomasz N2025-09-26
| | | | | | fix(extui): set options and buffer name after 'eventignorewin' Problem: Setting up extui buffers emits OptionSet and BufFilePost events. Solution: Set options and buffer name after 'eventignorewin'.
* fix(types): nvim_get_win_config return type #35639Lewis Russell2025-09-06
|
* fix(extui): error on :call input('') (#35515)phanium2025-08-27
| | | | Problem: Error on empty string prompt. Solution: (prompt .. '\n'):gmatch('(.-)\n').
* feat(extui): support paging in the dialog window (#35310)luukvbaal2025-08-21
| | | | | | | | | | | Problem: Unable to see e.g. `inputlist()` prompts that exceed the dialog window height. Multi-line prompts are not handled properly, and tracking is insufficient for messages in cmdline_block mode. Solution: Add vim.on_key handler while the dialog window is open that forwards paging keys to the window. Properly render multi-line prompts. Keep track of both the start and end of the current cmdline prompt. Append messages after the current prompt in cmdline_block mode.
* fix(extui): ensure temporary cmdline config is not restored #35301luukvbaal2025-08-11
| | | | Problem: Temporary cmdline config is saved to be restored later. Solution: Close the cmdline window so that it is recreated with the appropriate config.
* fix(extui): ensure windows are valid in scheduled on_key (#35106)luukvbaal2025-07-29
|
* fix(extui): attempt to perform arithmetic on field 'last_emsg' (#35047)phanium2025-07-24
| | | Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
* feat(ui2): more predictable routing #35028luukvbaal2025-07-22
| | | | | | Problem: Routing based on message kinds can be perceived as unpredictable. Solution: Implement phase 1 of #34281, always showing the full message in a window dismissed on any user input when it does not fit in the 'cmdheight'. Also show spill "[+n]" indicator if needed.
* fix(extui): disable cmdline highlighter when showing a message (#34887)luukvbaal2025-07-12
| | | | | | Problem: When message is moved from message window to cmdline, the cmdline highlighter is not disabled. Solution: Disable the highlighter (and only scroll to bottom when message was moved to pager).
* 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>
* feat(extui): show dismissed message in cmdline (#34745)luukvbaal2025-07-09
| | | | | | | | | | Problem: An accidental key press can dismiss a routed message to be shown in full before the user was able to read it. 'verbose' message routing based on an outdated condition results in "last_set" messages being separated from its message pair. Solution: Show a message to be shown in full in the cmdline window instead of the pager. Keep it there and update the spill indicator when the message is dismissed. Remove the 'verbose' message routing.
* feat(extui): don't enter pager for routed message #34679luukvbaal2025-06-27
| | | | | | | | Problem: Messages routed to the pager to be shown in full, enter the pager automatically, yielding another "press-q-prompt". Solution: Only enter the pager when requested explicitly. Otherwise, close the pager on the next typed mapping, unless that mapping entered the pager.
* 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.
* feat(ui): emit "msg_clear" event after clearing the screen (#34035)luukvbaal2025-06-26
| | | | | | | | Problem: ext_messages cannot tell when the screen was cleared, which is needed to clear visible messages. An empty message is also never emitted, but clears messages from the message grid. Solution: Repurpose the "msg_clear" event to be emitted when the screen was cleared. Emit an empty message with the `empty` kind to hint to a UI to clear the cmdline area.
* fix(extui): set 'modifiable', 'noswapfile' for buffers (#34582)phanium2025-06-20
| | | | | | Problem: UI buffers may be 'unmodifiable' and use a 'swapfile'. Solution: Set the 'modifiable' and 'noswapfile' options. Co-authored-by:phanium <91544758+phanen@users.noreply.github.com>
* fix(messages): add append parameter to history entries (#34467)luukvbaal2025-06-15
| | | | | | | | Problem: The "append" parameter added in abb40ece is missing from history entries, resulting in different message formatting for "g<". Solution: Add "append" field to message history entries. Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
* 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): only append messages exceeding 'cmdheight' to "more"Luuk van Baal2025-06-13
| | | | | | | | | | | | Problem: 8defe1a declared the "more" window the most convenient place to route messages to if it is already open for msg.pos == 'cmd'. In usage, this doesn't appear to be the case. Appending messages as added in that commit is still useful, but should only be done for messages that spill 'cmdheight'. Solution: Only append messages exceeding 'cmdheight' to the more window. To do this, instead of immediately writing to the more buffer, write to the cmd buffer and calculate its height. Then copy the text and its highlights to the more buffer.
* fix: `fn.exists()` typos (#34390)phanium2025-06-09
| | | | Problem: `exists()` checks should test for being equal to 1 rather than truthy, and extui check can be more restrictive. Solution: Adjust `exists()` guards to equal 1 and use `matchparen#CursorMoved`.
* 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): properly setup "more" window for changed bufferLuuk van Baal2025-06-02
| | | | | | Problem: Buffer setup after moving the message buffer to the "more" window after ff95d7ff is incomplete. Solution: Adjust and invoke tab_check_wins() to do the setup instead.
* fix(extui): reposition "more" window after entering cmdwinLuuk van Baal2025-06-02
| | | | | | | Problem: Closing the "more" window for an entered cmdwin in ff95d7ff9 still requires special casing to properly handle "more" visibility. Solution: Reposition the "more" window instead; anchoring it to the cmdwin.
* 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.
* fix(extui): incorrect cmdline cursor position (#34201)luukvbaal2025-05-27
| | | | | | | Problem: Calculated cmdline cursor position can be smaller than 0. Prompt part of the cmdline is translated, while it should support "\t" characters. Solution: Remove prompt part from the stored "cmdbuff" and get rid of dubious +/-1 from cmdline cursor calculation.
* feat(extui): route to "more" window if it is open (#34190)luukvbaal2025-05-27
| | | | | | | | | | | Problem: An already open "more" window is the most convenient place to route messages to with `cfg.msg.pos == 'cmd'`. Instead we route to the cmdline (unless that message also exceeds 'cmdheight'). Solution: Route to "more" window while it is open and scroll to bottom to show the newest message. This is more convenient and more efficient due to not writing to the target buffer first (which is done to calculate the height of the message). (Ensure message highlights are deleted when text is replaced.)
* fix(extui): write each message chunk pattern separately (#34188)luukvbaal2025-05-26
| | | | | | | | | | Problem: Bulking message lines to write in a single API call is complicated and still not correct w.r.t. overwriting highlights. Solution: Write each chunk pattern separately with it's highlight such that it will be spliced correctly for message chunks that contain a carriage return. Go with correctness over performance until this proves to be too inefficient. Also add an identifying name to the various extui buffers.
* fix(extui): using tracked message column in cleared buffer (#34154)luukvbaal2025-05-24
| | | | | | Problem: Using tracked message column as column in cleared buffer. Solution: Ensure column does not exceed current line length. Further work to ensure carriage return and cmdline block mode work properly.
* fix(extui): map wincmd instead of remapped key (#34151)phanium2025-05-24
| | | | Problem: "q" cannot close window when `<c-w>` is mapped. Solution: Map q to `<Cmd>wincmd c<CR>`.
* fix(extui): append consecutive :echon messagesLuuk van Baal2025-05-24
| | | | | Problem: Consecutive `:echon` messages are printed on separate lines. Solution: Implement the new msg_show->append parameter.
* fix(extui): reset message state after "search_cmd" message (#34119)luukvbaal2025-05-21
| | | | | | Problem: A "search_cmd" message alters the message state (since 8e8f4523), unnecessarily affecting logic for messages that follow. Solution: Reset the appropriate variables after a "search_cmd" message. Don't show "search_cmd" message with zero 'cmdheight'.
* fix(extui): translate <Tab> in cmdline text (#34055)luukvbaal2025-05-17
| | | | | | | Problem: <Tab> is not translated on the cmdline, and exposes a wrong assumption in search messages that may contain multiple chunks. Solution: Translate unprintable characters in the cmdline content. Extract the 'search_count' from the last chunk and route 'search_cmd' to cmdline to handle multiple chunks.
* fix(extui): better message highlighting after carriage return (#34034)luukvbaal2025-05-15
| | | | | | Problem: Incorrect message highlighting for highlighted message chunks containing carriage returns. Solution: Add a highlight for each substring ending in a newline or carriage return separately.
* 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.
* fix(extui): handle carriage return in messagesLuuk van Baal2025-05-14
| | | | | Problem: Carriage return should place the "write cursor" at the start of a line. Solution: Construct the to be printed line by iterating over carriage returns.