Skip to content

fix(pane-menu): add p) handler — paste system clipboard (text + image)#140

Merged
NagyVikt merged 1 commit into
mainfrom
agent/claude/fix-pane-menu-paste-from-clipboard-2026-05-16-01-02
May 15, 2026
Merged

fix(pane-menu): add p) handler — paste system clipboard (text + image)#140
NagyVikt merged 1 commit into
mainfrom
agent/claude/fix-pane-menu-paste-from-clipboard-2026-05-16-01-02

Conversation

@NagyVikt
Copy link
Copy Markdown
Contributor

Automated by gx branch finish (PR flow).

The right-click pane action menu lists "Paste (p)" but the script's case
statement had no `p)` branch — pressing 'p' was a silent no-op.
Operator hit this trying to paste content copied from outside the
terminal (Ctrl-V worked because kitty has its own bracketed-paste
shortcut wired straight to the system clipboard).

New behavior:
- Wayland: read system clipboard via wl-paste. If the clipboard holds
  an image (PNG/JPEG/GIF/WebP/BMP), save it to /tmp/clipboard-paste-<ts>
  .<ext> and paste the path as text — codex/claude can then read the
  file directly. If text, paste the text via tmux load-buffer +
  paste-buffer -p (bracketed paste).
- Fallback (no wl-paste): tmux paste-buffer (original behavior).

Out of scope: other unhandled menu shortcuts (w/K/r/t). One menu entry
per PR keeps the diff bounded; those can be lanes of their own.
@NagyVikt NagyVikt merged commit 8f955d5 into main May 15, 2026
@NagyVikt NagyVikt deleted the agent/claude/fix-pane-menu-paste-from-clipboard-2026-05-16-01-02 branch May 15, 2026 23:03
NagyVikt added a commit that referenced this pull request May 15, 2026
…nu (#141)

The iOS pane context menu now supports live ↑/↓ arrow navigation with a
focused row underlined in IOS_BLUE, ⏎ selects the focused row, hotkeys
still jump directly, and esc cancels. Disabled rows (zoom/swap/multi when
not applicable) are skipped during arrow walks but their hotkeys remain
wired for parity with prior behavior.

Also exposes the existing Paste-from-clipboard handler (PR #140) as a
"⤓  Paste from clipboard · p" row so operators can discover it.

Hint line updated to "↑/↓ move · ⏎ select · hotkey jumps · esc cancels".

Verification:
  bash -n scripts/codex-fleet/bin/pane-context-menu.sh -> OK
  docker shellcheck -> only pre-existing SC1091 on lib source (acceptable)
  CODEX_FLEET_MENU_LINE=demo bash pane-context-menu.sh '%0' </dev/null
    -> exit 0; Paste row + new hint present in render output

Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>
NagyVikt added a commit that referenced this pull request May 15, 2026
Refit scripts/codex-fleet/bin/help-popup.sh onto the same fg-only iOS
glass chrome as pane-context-menu.sh so the help popup matches its
sibling surface visually:

- Replace `_ios_sgr` (which emits both fg AND bg) with a local
  `menu_fg` helper that emits truecolor foreground only. Background
  stays at the terminal default so tmux popup `-B` lets the underlying
  pane show through.
- Use the agreed iOS palette: hairlines / corners #3A3A3C, section
  headers #007AFF bold (blue), key chips #FFCC00 bold (yellow), labels
  #FFFFFF, gray dot separator #8E8E93 between key + label, bottom hint
  #8E8E93.
- Sync the listed pane-menu shortcuts to current state: add `p` Paste
  from clipboard (PR #140), reword to match pane-context-menu.sh
  labels ("Copy whole session", "Swap with marked pane", …).
- Add a new "Nav (inside the pane menu)" section describing the
  arrow-nav focus model being added in the sister lane: ↑/↓ moves
  focus, ⏎ selects, esc cancels.
- Header now renders as `⌨  codex-fleet · keyboard help [ HELP ]` to
  mirror the pane menu's `● pane <idx> · <pane_id> [ LIVE ]` shape.
- Bottom hint updated to `any key closes  ·  esc/q exits`.
- Fix latent bug: top-level `local_pad=...` (outside any function)
  removed by moving header rendering into `draw_header()`.
- Smoke-test stanza added in the header comment:
  `bash scripts/codex-fleet/bin/help-popup.sh < /dev/null`.

Verification:
- bash -n scripts/codex-fleet/bin/help-popup.sh -> 0
- docker koalaman/shellcheck:stable -> 0
- grep -nE 'Paste from clipboard|↑ / ↓|⏎' -> 6 matches
- Smoke: bash help-popup.sh < /dev/null -> 0 (no solid-bg SGR in
  output: `grep -c '\[48;2;' = 0`).

Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
NagyVikt added a commit that referenced this pull request May 16, 2026
…ructured logging (#148)

PR #140's inline image-paste in pane-context-menu.sh only matched png/jpeg/gif/webp/bmp
and didn't validate the captured payload, causing silent "didn't quite work" failures
when modern browsers/screenshots provided avif/heic/svg, when wl-paste exited zero with
empty output, or when the wrong MIME landed first in --list-types output.

Extract a single source-of-truth helper that drives both the bash menu (pane-context-menu.sh)
and the tmux display-menu (style-tabs.sh):

- pane-menu-paste.sh (new): enumerates MIME types once, walks an extended image preference
  list (png > webp > jpeg > avif > heic > heif > gif > bmp > tiff > svg+xml > x-icon),
  validates each saved image by size guard (>100 bytes) + magic-byte sniff (PNG/JPEG/GIF/
  WebP/BMP/TIFF/ICO/AVIF/HEIC ftyp box/SVG xml header), falls through to the next MIME on
  failure, then to text/uri-list (pastes file paths from file managers), then text/plain.
  Saves images under /tmp/codex-fleet-clipboard/ (mode 700, auto-prunes >1h files), logs
  every invocation to /tmp/codex-fleet-paste.log with mime/size/path/error for tail -f
  debugging, caps the log at 100KB. Falls back to tmux's own paste-buffer when wl-paste
  is missing entirely.
- pane-context-menu.sh: replaces the 30-line inline p) case with a one-line shellout.
- style-tabs.sh: rewires the MouseDown3Pane Paste row to call the same helper so the two
  menu surfaces stay behaviorally identical.

Verification: bash -n + shellcheck (docker koalaman/shellcheck:stable) clean on all three
files (only pre-existing SC1091 source-resolution info on pane-context-menu.sh remains).
Smoke tests covered text/empty-clipboard/PNG-too-small/PNG-magic-validated paths against
a fake pane id; helper exits cleanly with structured log lines in all cases.

Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant