mirror of
https://github.com/openai/codex.git
synced 2026-11-11 21:10:39 +00:00
Add configurable right-click paste to the fullscreen TUI (#48118)
## What changed - Add `tui.right_click_paste` with `auto`, `on`, and `off` modes. The default `auto` enables the fallback on Windows and Linux, including WSL when terminal detection is conclusive. `on` also enables macOS. Both modes skip SSH sessions and recognized VS Code terminals. - Paste clipboard text through the normal composer input path when no selection, search, or blocking view takes precedence. Discard pending results after intervening input, focus loss, or changes to the target thread, draft, or cursor. - Read text asynchronously through the shared clipboard worker, with a five-second deadline and the message size limit. Read the Windows clipboard through PowerShell on WSL and reject overlapping clipboard operations. ## Testing Add coverage for platform and terminal policy, normal paste delivery, stale reads, overlapping clipboard operations, read timeouts, oversized text, and large command output. GitOrigin-RevId: 0a7b6d445c09928da6c5335841ba2a9a66cc7e4b
This commit is contained in:
@@ -741,6 +741,19 @@ pub enum TuiPetAnchor {
|
||||
ScreenBottom,
|
||||
}
|
||||
|
||||
/// Right-click text paste when the fullscreen TUI has no selection.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, Default)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum RightClickPaste {
|
||||
/// Enable on Windows/WSL/Linux, except recognized terminal-owned paste paths.
|
||||
#[default]
|
||||
Auto,
|
||||
/// Enable on supported local platforms; selection and terminal-owned paste still win.
|
||||
On,
|
||||
/// Leave right-click paste to the terminal.
|
||||
Off,
|
||||
}
|
||||
|
||||
/// When transcript mouse selections are copied on release.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, Default)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
@@ -857,6 +870,12 @@ pub struct Tui {
|
||||
#[serde(default)]
|
||||
pub copy_on_select: CopyOnSelect,
|
||||
|
||||
/// Right-click text paste fallback. Defaults to `auto` (Windows/WSL/Linux).
|
||||
/// `on` also enables macOS; neither mode reads over SSH or in recognized VS Code terminals.
|
||||
/// This controls the fullscreen fallback, not the terminal's own paste binding.
|
||||
#[serde(default)]
|
||||
pub right_click_paste: RightClickPaste,
|
||||
|
||||
/// Controls whether the TUI uses the terminal's alternate screen buffer.
|
||||
///
|
||||
/// - `auto` (default): Use alternate screen.
|
||||
|
||||
Reference in New Issue
Block a user