mirror of
https://github.com/openai/codex.git
synced 2026-11-29 00:00:54 +00:00
## 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
34 lines
1017 B
Rust
34 lines
1017 B
Rust
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[test]
|
|
fn policy_preserves_explicit_modes_and_terminal_ownership() {
|
|
use VscodeDetection::Other;
|
|
use VscodeDetection::Unknown;
|
|
use VscodeDetection::VsCode;
|
|
for (platform_default, ssh, wsl, vscode, expected) in [
|
|
(true, false, false, Other, [false, true, true]),
|
|
(false, false, false, Other, [false, true, false]),
|
|
(true, true, false, Other, [false, false, false]),
|
|
(true, false, false, VsCode, [false, false, false]),
|
|
(true, false, true, Unknown, [false, true, false]),
|
|
(true, false, true, Other, [false, true, true]),
|
|
] {
|
|
let env = PasteEnvironment {
|
|
platform_default,
|
|
ssh,
|
|
wsl,
|
|
vscode,
|
|
};
|
|
assert_eq!(
|
|
[
|
|
RightClickPaste::Off,
|
|
RightClickPaste::On,
|
|
RightClickPaste::Auto
|
|
]
|
|
.map(|mode| env.allows(mode)),
|
|
expected
|
|
);
|
|
}
|
|
}
|