Skip to content

feat(mecatui): clickable permission + plan-review buttons - #496

Merged
JAORMX merged 3 commits into
mainfrom
issue-486-mouse-interactions
Aug 13, 2026
Merged

JAORMX merged 3 commits into
mainfrom
issue-486-mouse-interactions

Conversation

@jbeda

@jbeda jbeda commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Ships the first of three mouse-interaction consumers split out of #486: clickable permission-modal and plan-review buttons. A left-click on Allow / Always / Deny (or the plan-review bar's approve & run / auto-accept edits / iterate) resolves the ask to that button's verdict — exactly like pressing its key chord. A click anywhere else in the modal is swallowed (it's a gate, not a form).

The other two consumers were split into follow-ups (per the implementation plan on #486): click-to-open URLs → #489, textarea click-to-caret → #490.

How it works

  • cmd/mecatui/ui/clickgeom.go (new) — arithmetic hit-test geometry. The render path and the hit-test share ONE source for the button row (permissionButtonsLine / planButtonsLine) and ONE source for the body's screen position (convTopRow ← chrome()), so they can't disagree. Button rects are measured with lipgloss.Width on the same styled labels the renderer places, so a rebound chord's wider standalone label is hit-tested at its true width.
  • permission.go — extracted the two button-line builders and split renderPermissionModal → renderPermissionModalBody/permissionModalBodyParts so the builder that lays out the body also owns where the buttons landed.
  • update.go — a phaseAwaitingApproval branch in onMousePress before the selectable() gate; resolves on press (key-chord parity) and deliberately does not touch the multi-click / drag-selection state machine.

Alt-screen only (mouse capture lives there); --inline/--no-mouse leave the mouse uncaptured for native selection, unchanged.

Review

Panel review (spec + standards + architecture + duplication) ran on the first commit. The spec axis caught a real bug: the generic modal's click band was one row too low, so the footnote row wrongly resolved Allow. Fixed in the second commit (builder now owns the button row; shared approvalButtonSep const; new regression test pinning the hit band to the exact rendered-box rows).

Verification

  • task lint — 0 issues
  • task test — 128 packages green
  • View goldens byte-stable (the button-line extraction is a pure refactor)
  • llms.txt byte-identical (docs row added no new links); task docs link gate green
  • go run ./cmd/mecademo — full offline session intact

Test plan

9 new tests in clickgeom_test.go: rect tiling, per-button hit/miss, click→verdict resolution for both the modal and the plan bar, two-button (child-ask) modal has no middle rect, plan-bar clamp keeps the footnote from resolving, hit band matches the rendered box rows exactly, and the phase gate.

Closes #486 (buttons portion; #489 + #490 track the rest).

Draft: dog-food the click feel before marking ready.

jbeda and others added 3 commits August 12, 2026 15:15
A left-click on a permission modal or plan-review action-bar button now
resolves it to that button's verdict, exactly like pressing its key
chord (issue #486). The hit-test is arithmetic geometry derived from the
same layout model (chrome/convTopRow) and styled-label widths the
renderer uses, sharing ONE source for the button row
(permissionButtonsLine/planButtonsLine) so render and hit-test can never
disagree. A click elsewhere in the modal is swallowed (it is a gate, not
a form).

This is the first of three mouse-interaction consumers split from #486;
click-to-open URLs (#489) and textarea click-to-caret (#490) are
follow-ups.

Co-Authored-By: mecatl <[email protected]>
Panel review on fb18059 caught the generic modal's click band shifted
one row low: the footnote row wrongly resolved Allow and the box's
top-border row missed. Root cause: buttonsLineRow re-derived the buttons
row from the body's trailing write order and mixed content/card frames.

Fix: the builder that lays out the body now owns the button box's top
row (permissionModalBodyParts returns it alongside the body), so render
and hit-test agree by construction. Also promote the button separator to
a shared const (approvalButtonSep) so the JoinHorizontal render and the
hit-test column arithmetic can't desync. A new regression test pins the
hit band to the exact rendered-box rows (footnote excluded).

Co-Authored-By: mecatl <[email protected]>
@JAORMX
JAORMX marked this pull request as ready for review August 13, 2026 11:07
@JAORMX

JAORMX commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Dog-food testing passed in the built PR worktree.

Tested bin/mecatui in its normal alternate-screen mouse-capture mode against a scratch workspace:

  • triggered a permission ask for an edit and clicked Allow / Always / Deny;
  • verified clicks on the visible button labels match the keyboard verdicts, while the modal title/body, footnote, and border do not resolve the ask;
  • used plan mode, scrolled the plan, and clicked approve & run, auto-accept edits, and iterate;
  • verified the plan bar’s footnote and blank separator do not resolve an ask;
  • confirmed --no-alt-screen leaves approval clicks inactive while keyboard approval remains available.

CI is green: 12 successful checks, with the 3 expected PR skips and no failures.

@JAORMX
JAORMX merged commit b90a38c into main Aug 13, 2026
15 checks passed
@JAORMX
JAORMX deleted the issue-486-mouse-interactions branch August 13, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mecatui: mouse interactions beyond drag-selection (links, approval buttons, textarea caret)

2 participants