fix(terminal): bridge Ctrl+V clipboard paste into the pty (Li+ Desktop) - #88
Merged
liplus-lin-lay merged 1 commit intoJun 16, 2026
Conversation
埋め込みターミナル(xterm.js)に paste の配線が無く、Ctrl+V がクリップボードのテキストを pty に届けられなかった(人間操作・自動操作とも)。tauri-plugin-clipboard-manager を導入し、createSessionTerminal に Ctrl+V / Ctrl+Shift+V を捕まえるハンドラを追加して clipboard を読み write_pty に流す。e.preventDefault でネイティブ paste との二重入力を抑止した。 tauri dev で日本語テキストの貼り付けが1回でクリーンに pty(claude セッション)へ通ることを実機確認済み。 Refs #87 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
liplus-lin-lay
commented
Jun 16, 2026
liplus-lin-lay
left a comment
Member
Author
There was a problem hiding this comment.
AI self-review (auto モード)
- 変更は最小・対象限定。paste ハンドラは Ctrl/Cmd+V(keydown, Alt 除外)のみ捕捉し、Ctrl+C 等は素通し(SIGINT に影響なし)。
- 権限は
clipboard-manager:allow-read-textのみ(read 限定=最小権限。write は不要なので付与せず)。 - 実機検証済み:
tauri devで日本語の Ctrl+V 貼り付けが pty(claude セッション)へ1回でクリーンに到達。初回の二重入力はe.preventDefault()で解消し、再検証で単一を確認。 - 型チェック
tsc --noEmitパス、Rust ビルド成功。CI 設定は無し(プロトタイプ)。 - 規模=小・user/system observable な挙動修正 → patch 相当。
PASS。squash マージする。
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.
概要
埋め込みターミナル(xterm.js)で Ctrl+V による貼り付けが pty に届かない問題を修正。
原因
src/tabs.tsのcreateSessionTerminalはterminal.onData → write_ptyでキー入力のみ pty に流しており、paste を処理する配線が無かった。加えて Tauri の clipboard プラグインが未導入だった。変更
tauri-plugin-clipboard-manager(JS/Rust)を追加し、lib.rsで登録、capabilities/default.jsonにclipboard-manager:allow-read-textを許可。createSessionTerminalにattachCustomKeyEventHandlerを追加:Ctrl+V / Ctrl+Shift+V を捕まえ、clipboard を読んでwrite_ptyでアクティブセッションの pty に流す。e.preventDefault()でネイティブ paste との二重入力を抑止。検証
tauri devで起動し、Ctrl+V で日本語テキストが pty(claude セッション)へ 1回でクリーンに 通ることを実機確認(初回は二重入力 → preventDefault で解消、再検証で単一を確認)。Closes #87