Skip to content

mecatui: click-to-open URLs in scrollback #489

Open

Description

@jbeda

Split out of #486 (mouse interactions). The first PR ships clickable approval/plan-review buttons; this is the follow-up for click-to-open links in the conversation scrollback.

Behaviour

A single left-click (press+release, no drag) on a URL in the conversation scrollback opens it in the platform browser. Drag-selection, double-click word-select, and triple-click line-select are unchanged — the open fires only on a clean single click (clickCount==1 + empty selection at release, the existing onMouseRelease empty branch in cmd/mecatui/ui/update.go).

Trust boundary (load-bearing)

Scrollback content is model-influenced and untrusted. The URL must be:

  • parsed with net/url.Parse (never regex-guess the scheme),
  • gated on a scheme allowlist {https, http, mailto} (the allowlist lives in ui, the consumer),
  • passed to the opener as ONE direct argv element — NEVER through a shell (sh -c would be command injection on file:///sh: schemes),
  • length-clamped (e.g. 2048) and control-byte-rejected.

Shape (from the #486 plan)

  • client/urllaunch.go (new): URLOpener interface + NewURLOpener() probing xdg-open/open/rundll32 — mirrors client/clipboard.go's probe + injected-runner pattern. os/exec stays in client, never in ui.
  • ui/urls.go (new): urlAtLine(stripped, col) tokenizer (grapheme-walk like wordAt), scheme allowlist, openURLCmd (async tea.Cmd like shellWriteCmd), muted status on success/failure.
  • Deps gains Opener client.URLOpener (nil disables).
  • OSC8 hyperlink RENDERING is explicitly out of scope (would break View goldens + interfere with styleSelection ANSI splicing); click-to-open works by hit-testing text against a URL scan at click time, independent of rendering.

Known v1 limitation: a URL soft-wrapped across two viewport lines is only detected from the clicked line's fragment.

Activity

  1. added
    enhancement
    tui
    on Aug 12, 2026
  2. self-assigned this
    on Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementtui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions