Skip to content

Deduplicate clipboard-before-paste wiring across backends #381

Description

@JDonaghy

Problem

Both backends intercept p/P (and Ctrl+V in insert mode) to load the system clipboard into engine registers before dispatch:

  • TUI: intercept_paste_key (~37 lines) + insert-mode clipboard (~38 lines)
  • GTK: clipboard read before paste (~20 lines)

Engine::load_clipboard_for_paste(text) already exists but the wiring around it (detecting the paste key, reading the system clipboard, calling the method) is duplicated.

Proposed fix

Consider whether the engine can own paste detection — e.g. Engine::handle_key could accept an optional clipboard provider callback, or the engine could expose needs_clipboard_for_key(key) -> bool so backends share the detection logic.

Context

Identified in Session 370 backend dedup audit.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions