Skip to content

[BUG REPORT] 修复 Windows 无文本剪贴板未通知括号粘贴程序的问题 - #71

Open
WhiteGiverMa wants to merge 1 commit into
ELY-Open-Source:mainfrom
WhiteGiverMa:fix/windows-empty-paste
Open

WhiteGiverMa wants to merge 1 commit into
ELY-Open-Source:mainfrom
WhiteGiverMa:fix/windows-empty-paste

Conversation

@WhiteGiverMa

@WhiteGiverMa WhiteGiverMa commented Nov 3, 2026 •

Copy link
Copy Markdown

Type

  • [FEATURE REQUEST]: a new feature or an improvement
  • [BUG REPORT]: a bug fix
  • [Other]: docs, refactoring, CI, dependencies or chores

What and why

Windows 上剪贴板没有文本时,向开启 bracketed paste 的程序发送空粘贴通知,让 OpenCode 等应用自行读取图片。

Closes #70

Bug details

  • Steps to reproduce: 复制截图,在 ELYTerminal 0.2.2 中运行 OpenCode 2.2.5,输入框聚焦时按 Ctrl+V。
  • Expected: 与 Windows Terminal 1.24 相同,出现 [image1] 附件占位。
  • Actual: ELY 消费 Ctrl+V 后因剪贴板没有文本直接返回,应用收不到粘贴事件。
  • Cause and fix: 仅在 Windows 且 BRACKETED_PASTE 开启时,将无文本粘贴转为 paste_text(""),通过现有编码器发送 ESC[200~ESC[201~。OpenCode 2.2.5 已支持这个零字节粘贴入口。

文本 / 文件路径、未开启括号粘贴的无文本处理、kitty 5522 优先分支及其他平台行为不变。不传输图片、不生成临时图片文件,也不新增配置或依赖。本 PR 基于 main ba664ef6,不包含 #69 的滚轮修改。

How it was tested

真实 ELY 窗口中通过 Window::dispatch_event(KeyDown(ctrl-v)) 进入现有快捷键和 Paste handler,再经 OpenConsole / ConPTY 由原始 VT 输入子程序读取:

用例 结果
普通文本 修复前后字节相同,保留 bracketed-paste 标记
仅图片,合成 8×8 位图 修复前 0 字节;修复后恰好 12 字节 ESC[200~ESC[201~
空剪贴板,2004 开启 12 字节空粘贴通知
图片,2004 未开启 0 字节
图片,kitty 5522 开启 原有 OSC 5522 类型通知,不含 bracketed-paste 标记

另在实际 OpenCode 2.2.5 的 PTY 中,以合成图片剪贴板和上述 12 字节输入验证,界面显示 [image1]。

验证边界:ELY 从 GPUI 事件入口开始测试,不包含原生物理键盘;OpenCode 消费端独立验证。未在 macOS / Linux 运行。临时驱动未加入 PR,没有新增自动回归测试。

Windows x86_64 MSVC,Rust 1.95.0:

cargo fmt --check
cargo clippy --locked --all-targets -- -D warnings
cargo test --locked --quiet
cargo build --locked
git diff --check

fmt、Clippy、构建及 diff 检查通过。完整测试 414 passed / 1 failed:未修改的 settings::store::tests::overlapping_saves_leave_one_whole_file 在并发 rename 时返回 Windows os error 5(拒绝访问)。src/settings/store.rs 与 main 无差异,该失败未在本 PR 中处理。

Checklist

  • The title starts with [FEATURE REQUEST], [BUG REPORT] or [Other]
  • Tests and the build pass locally(构建通过;完整测试有上述并发保存失败)
  • Docs are updated if behaviour changed

@WhiteGiverMa

Copy link
Copy Markdown
Author

我现在已经在本地用着 #69 和 #71 的合并构建了哦,表面验证都通过了,有什么问题的话会在下面追加的

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.

[BUG REPORT] Windows Ctrl+V 图片时未发送空粘贴通知,OpenCode 无法添加剪贴板图片

1 participant