refactor: route GTK clipboard read/write through engine callbacks (#417) - #419
Merged
Conversation
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
added a commit
that referenced
this pull request
May 16, 2026
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>
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
App.clipboard: Option<Box<dyn ClipboardProviderExt>>and the inline copypasta_ext setup inApp::init. All clipboard work now goes throughengine.clipboard_read/engine.clipboard_write— the same callback model the TUI already uses.setup_gtk_clipboard(&mut Engine)wires the provider once at startup, wrapped inRc<RefCell<…>>so the shared-refFncallbacks can acquire the&mut selfthatClipboardProviderExt::{get,set}_contentsneed.Test plan
Built on macOS dev tree:
cargo test --no-default-features --lib→ 1963 passed;cargo fmtclean. GTK build / clippy can't run on this machine (glib-2.0not installed). Pre-existing failures on develop (src/render.rsContextMenuItem field bump, unuseddirincore/engine/windows.rs:555) are unrelated.Linux smoke checklist (no behavior change expected):
cargo buildsucceeds (ignore the pre-existing render.rs / windows.rs failures on develop — separate issue).yy), paste into another app — confirmssync_plus_register_to_clipboard→clipboard_write.pin normal mode — confirmsneeds_clipboard_for_paste→clipboard_read→prepare_paste_clipboard.y(orY, or Ctrl-C) — should show "Hover text copied" and paste outside.If any check fails, the regression is in
setup_gtk_clipboardor one of the 6 rewired sites.🤖 Generated with Claude Code