tui: selectable + clickable permission popup#232
Conversation
The permission prompt now has a moving cursor and clickable options, on top of the existing a/y/d hotkeys (which still resolve directly): - ↑/↓ and Tab/Shift+Tab move the highlight across allow once / always / deny (resting default: allow once); Enter confirms the highlighted option. - each option is rendered on its own row, and a left-click on a row resolves that choice directly. - permission_prompt.go: permissionOptions + cursor move/clamp/confirm helpers. - model.go: pendingPermissionPrompt gains a cursor; Enter confirms it, ↑/↓/Tab move it; a/y/d are unchanged. - rendering.go: renderFocusedPermissionPrompt renders per-option rows with the cursor highlighted (▸ + reverse label) and returns each option's card-relative Y offset so the caller can register clickable rows. - transcript_selection.go: transcriptSelectableLine gains permOption/permChoice; the pending-permission item registers each option row as clickable, and a left-click on one resolves the permission. Tests: cursor default/move/wrap, Enter confirms the highlight, hotkeys still resolve directly, render emits highlighted clickable offsets. Existing card/ submit-block tests updated for the new per-option layout + Enter-confirms.
Zero automated PR reviewVerdict: No blockers found Blockers
Validation
ScopeHead: This deterministic review checks validation status and basic diff hygiene. A human reviewer still owns product judgment and design quality. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
WalkthroughAdds cursor-based keyboard navigation (Tab, Shift+Tab, Up/Down, Enter) and mouse-click support to the TUI permission prompt. A new ChangesPermission Prompt Cursor Navigation and Mouse Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Vasanthdev2004
left a comment
There was a problem hiding this comment.
LGTM ? no issues found. The permission popup cursor/click wiring is correct: heightCacheStable is a real field on transcriptBodyItem on main (added by #226), the cursor wraps correctly under Go signed modulo, and the option offsets match the styledBlockFill one-top-border contract.
Vasanthdev2004
left a comment
There was a problem hiding this comment.
LGTM ? no issues found. The permission popup cursor/click wiring is correct: heightCacheStable is a real field on transcriptBodyItem on main (added by #226), the cursor wraps correctly under Go signed modulo, and the option offsets match the styledBlockFill one-top-border contract.
|
Parity check against the reference Droid (D) implementation. D's SandboxPermissionPrompt offers context-dynamic options: for file-write violations it offers both 'Allow always (writes to )' and 'Allow always (writes to )'; for network violations it offers 'Allow always ()'; for deny-list entries it offers 'Remove from deny list'. See src/sandbox/SandboxPermissionPrompt.ts -> getSandboxPromptOptions. Zero's permissionOptions() is a fixed 3-item list (allow once / always / deny) with no path/domain context in the 'Allow always' label. This is a known gap, not a bug in this PR's scope. The cursor/wrap/click wiring itself matches D's SandboxViolationPrompt behavior (up/down wraps, Enter confirms the highlighted option). |
Summary
Makes the permission prompt navigable and clickable, on top of the existing
a/y/dhotkeys (which still resolve directly):Re-ports a local feature onto current
main, adapted to main's refactored row-based selection layer (transcriptBodyItemrender closures +layout.selectable).How it works
permission_prompt.go—permissionOptions+ cursorclamp/move/confirmhelpers (the cursor lives on the pending prompt).model.go—pendingPermissionPromptgains acursor; Enter →confirmPermissionCursor, ↑/↓/Tab →movePermissionCursor;a/y/dunchanged and still ignore the cursor.rendering.go—renderFocusedPermissionPromptnow renders one row per option with the cursor highlighted (▸+ reverse label) and returns each option's card-relative Y offset so the caller can register clickable rows.transcript_selection.go—transcriptSelectableLinegainspermOption/permChoice; the pending-permission item registers each option row as clickable, and a left-click on one callsresolvePermission.Tests
a/y/dstill resolve directly; render emits highlighted clickable offsets that map to the right rows.gofmt,go vet,go build(host/linux/windows),go test ./internal/tui -race, staticcheck — all green (the two unused-func nits are pre-existing onmain).Note
Keyboard nav + the offset→row mapping are covered by tests; the end-to-end mouse click on an option is best confirmed interactively in a real terminal.
Summary by CodeRabbit
Release Notes