stacklok / stacklok/mecatl

mecatui: text in overlays and on the welcome splash cannot be selected or copied

Open
#1,475 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug tui ux
Dominant language
Go
Stars
152
Forks
16
Avg merge
14h 48m
Merged PRs (30d)
536

Description

Bug description

In the alt-screen TUI with mouse capture on (the default), several regions hold text
that cannot be copied by any means: in-app selection refuses to start there, and
because the app captures the mouse, the terminal's own click-drag selection is
suppressed too.

There are two distinct causes behind one symptom.

1. Overlays block selection by design

selectable() in cmd/mecatui/ui/selection.go returns false whenever
bodyOwnerOpen(m) is true, or the phase is phaseFatal / phaseAwaitingApproval /
phaseReplay. That covers /agents, /models, /skills, /mcp, /team, /soul,
/usermodel, /worktrees, /schedule, help, session details, every modal, and the
fatal screen. It is documented in docs/tui.md as intentional:

Conversation selection is blocked while an overlay/modal owns the screen [...] a
press there starts nothing

The design reasoning holds, but the user-visible result is that the agent names in
/agents, a model id in the picker, and the text of an error dialog are all
uncopyable, with no in-context hint that an escape hatch exists.

2. The welcome splash is a separate, undocumented case

renderBody() in cmd/mecatui/ui/view.go renders renderZeroState() directly rather
than through m.vp, but screenToContent() maps a click into m.vp.GetContent().
The splash is not an overlay, so selectable() returns true and the drag gesture is
accepted. It just resolves against viewport content that does not hold the splash
text. This is the mecatui <version> case from the report: the drag is accepted and
yields nothing useful, rather than being cleanly refused like an overlay.

Steps to reproduce

  1. Start mecatui with defaults (alt screen, mouse captured).
  2. On the first-run home screen, drag over the mecatui <version> line and release.
    Nothing useful is copied.
  3. Run /agents. Drag over an agent name. No selection starts.
  4. Same for /models, help, session details, and any error dialog.

Expected behavior

Text visible in the TUI can be copied, or the UI says how to copy it.

Actual behavior

The text is uncopyable through both the in-app layer and the terminal's native
selection, with no on-screen indication of why or what to do instead.

Workarounds today

These work but are not discoverable from inside the affected surfaces:

  • --no-mouse / MECATUI_NO_MOUSE=1: drops mouse capture, restoring native
    click-drag selection, at the cost of in-app wheel scroll and drag-select.
  • --inline / --no-alt-screen: likewise leaves the mouse uncaptured.
  • shift+drag in terminals that pass shift-modified mouse events through.

Possible directions

Not prescriptive, listing them so the trade-offs are visible up front:

  • Extend in-app selection to overlay bodies. They are rendered strings like the
    viewport, and the selection layer is already logical-content-indexed, so the work is
    mostly giving it a per-surface content source instead of the hard-wired m.vp.
  • Fix the splash so it either participates in selection or cleanly refuses.
  • A per-item copy affordance keyed off the focused row or field, which is cheaper than
    general selection and fits list surfaces like /agents well. #525 did exactly this
    for the session ID.
  • Discoverability: when a drag lands on a non-selectable surface, say so and point at
    --no-mouse / shift+drag.

Environment

  • OS/version: macOS (also reported independently by another user)
  • mecatl version or commit: reproduces on current main; not version-specific
  • Deployment shape: mecatui

Additional context

Related: #769 (click-to-select rows in picker overlays), #489 (click-to-open URLs),
#525 (closed, copyable session ID), #770 and #486 (closed, the mouse-gesture work that
built the current selection layer).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with selectable() in cmd/mecatui/ui/selection.go and the renderBody(), renderZeroState(), and screenToContent() paths in cmd/mecatui/ui/view.go. Reproduce selection on the welcome splash and overlay surfaces, then determine which stated direction fits the existing selection behavior. Done means visible text can be copied, or the affected surface clearly explains an available workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.