Repository navigation
Conversation
… on click The prompt's agent, model and variant, its "tab agents" and "ctrl+p commands" hints, the sidebar session title and the sidebar MCP rows show something a keybind or slash command acts on, but did nothing when clicked. Each now dispatches that command through the keymap: the agent, model and variant pickers, agent.cycle, the command palette and session.rename. An MCP row connects or disconnects that server without opening /mcps; the toggle, its status refresh and its in-flight guard move from DialogMcp into local.mcp so the dialog and the row share them, and the row's dot shows "⋯" while the server answers. The home footer's MCP count opens /status and the sidebar's "Connect provider" opens /connect. ui/click.ts runs an action only for a left press and release on the same cell that leaves no text selected, so drag-to-copy keeps working on these elements.
Contributor
|
Thanks for putting this together, @Nowaker, and for the thorough description and testing notes! v1 (the Clickable TUI elements still look relevant for v2. When you're ready, please open the change against the |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
4 of 6 tasks
This was referenced Oct 15, 2026
4 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: I'm aware v1 is now the maintenance branch and new features go to v2 only. This PR is here for others to use, and I'll submit the v2 version once I've migrated my whole plugin system to it.
Issue for this PR
Closes #48563
Also covers #40521 (click an MCP row in the sidebar to toggle it) and #13242 (click the sidebar title to rename the session); both were closed by the inactivity bot. Related: #12315, #11881.
Type of change
What does this PR do?
Many parts of the TUI show something you can change, copy or open, but nothing happens when you click them, so mouse users have to remember the keybind or slash command. After this PR, clicking each of them runs the same command as its keybind, or copies what it shows:
/agents)/models)/variants)tab agentstabctrl+p commandsesc interruptesc: the first click asks for a second, a second click within 5 s interrupts/status)/rename)ses_...,msg_...)/mcps; the dot shows⋯until the server answers/diff) at that file/status/status)/connect)Where a command exists, the click goes through
keymap.dispatchCommand, so it runs the registered command and duplicates none of its logic. The MCP toggle, its status refresh and the guard against a second toggle while one is running move fromDialogMcpintolocal.mcp, so the dialog and the sidebar row share them.DialogModelaccepts a model to highlight, and the diff route accepts afileto open at.An ID is read back from the cells drawn under the pointer, inside the element that was clicked (
ui/id-click.ts), so markdown concealment and highlighting don't matter, and the message and tool click handlers stand down when an ID is under the pointer: one click runs one action.A click counts only when the left button is pressed and released on the same cell and no text ends up selected (
ui/click.ts). Dragging across any of these elements still selects and copies text, nothing happens on hover, and the prompt's own caret clicks are unchanged.tui.mdxgets a "Clickable elements" section with the table above.How did you verify your code works?
test/ui/click.test.tscovers the click guard (a same-cell click runs the action; a drag, a right click, a release without a press, or a click that leaves text selected does not).test/ui/id-click.test.tscovers reading an ID from the drawn cells.test/cli/tui/diff-viewer.test.tsxcovers opening the diff viewer at a file, and fails without the change.bun typecheckandbun testpass inpackages/tui(204 pass, 1 skip).XDG_*dirs, a throwaway tmux socket, a local OpenAI-compatible provider withhigh/lowvariants that answers with session and message IDs and makes todo and write tool calls, and two local MCP servers, one disabled), I sent SGR mouse clicks to each element:dev, none of them did anything;tab agentsswitched Build to Plan;spare Disabledshowed⋯ spareand thenspare Connected, with no dialog; IDs in the answer and the sidebar copied with "Copied ses_..." / "Copied msg_..."; the directory copied; a todo copied and landed in the prompt; the footer model opened Select model on that turn's model; and the first click onesc interruptshowed "esc again to interrupt", the second ended the turn as "interrupted".Checklist
This PR is AI generated, but under direct supervision and on request of @Nowaker.