Skip to content

refactor: route GTK clipboard read/write through engine callbacks (#417) - #419

Merged
JDonaghy merged 1 commit into
developfrom
issue-417-clipboard-dedup
May 16, 2026
Merged

refactor: route GTK clipboard read/write through engine callbacks (#417)#419
JDonaghy merged 1 commit into
developfrom
issue-417-clipboard-dedup

Conversation

@JDonaghy

Copy link
Copy Markdown
Owner

Summary

  • Drops App.clipboard: Option<Box<dyn ClipboardProviderExt>> and the inline copypasta_ext setup in App::init. All clipboard work now goes through engine.clipboard_read / engine.clipboard_write — the same callback model the TUI already uses.
  • 6 GTK call sites rewired: yank sync, paste prep, hover-popup copy, terminal copy, terminal paste, AI panel Ctrl-V.
  • New helper setup_gtk_clipboard(&mut Engine) wires the provider once at startup, wrapped in Rc<RefCell<…>> so the shared-ref Fn callbacks can acquire the &mut self that ClipboardProviderExt::{get,set}_contents need.
  • A future macOS (NSPasteboard) backend now installs its own callbacks with zero call-site changes. Closes Deduplicate clipboard read/write across backends #417.

Test plan

Built on macOS dev tree: cargo test --no-default-features --lib → 1963 passed; cargo fmt clean. GTK build / clippy can't run on this machine (glib-2.0 not installed). Pre-existing failures on develop (src/render.rs ContextMenuItem field bump, unused dir in core/engine/windows.rs:555) are unrelated.

Linux smoke checklist (no behavior change expected):

  • cargo build succeeds (ignore the pre-existing render.rs / windows.rs failures on develop — separate issue).
  • Yank in vimcode (yy), paste into another app — confirms sync_plus_register_to_clipboardclipboard_write.
  • Copy from another app, then p in normal mode — confirms needs_clipboard_for_pasteclipboard_readprepare_paste_clipboard.
  • Hover popup focused, press y (or Y, or Ctrl-C) — should show "Hover text copied" and paste outside.
  • Integrated terminal: select + copy → paste outside; copy outside → paste into terminal.
  • AI sidebar input focused, Ctrl-V — should insert the system clipboard text.

If any check fails, the regression is in setup_gtk_clipboard or one of the 6 rewired sites.

🤖 Generated with Claude Code

Drops the per-backend `App.clipboard` field and the inline copypasta_ext
setup in `App::init`. All 6 GTK call sites (yank sync, paste prep, hover
copy, terminal copy/paste, AI Ctrl-V) now go through `engine.clipboard_read`
/ `engine.clipboard_write` — the same model the TUI already uses. A future
macOS (NSPasteboard) backend just installs its own callbacks with zero
call-site changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@JDonaghy
JDonaghy merged commit 0157386 into develop May 16, 2026
JDonaghy added a commit that referenced this pull request May 16, 2026
…419)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
JDonaghy added a commit that referenced this pull request May 16, 2026
Replace uniform `row_h` with `toolbar_y`, `content_y`, and
`content_row_h` so backends with non-uniform row heights (e.g. GTK's
taller tab bar) get correct zone detection. Also fixes:
- TerminalCopySelection RefCell double-borrow (same pattern as #419)
- ContextMenuItem ..Default::default() compile error after rebase

Co-Authored-By: Claude Opus 4.6 (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