External editor (Ctrl+G): TUI is not hidden before launching editor, causing screen corruption and lost keystrokes
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 66/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, neovim
- 領域
- cli
調査の方向性
Start by locating openInEditor and openMemoryFileInEditor, then trace how withLegacyKeyboard wraps the editor spawn without stopping the TUI. Compare that path with the referenced pi pattern: this.tui.stop() before spawning, and this.tui.start() plus this.tui.requestRender(true) in a finally block. Reproduce with cmd, Ctrl+G, and nvim; done means the editor owns the terminal cleanly, keystrokes are not lost, the prompt is captured on return, and the TUI redraws fully.
索引モデルが issue の本文から書いたものです。
説明
Summary
When Command Code launches an external editor via Ctrl+G, it does not stop/hide its TUI first. The TUI's render loop (git-polling statusline, autocomplete/snippet UI) keeps writing to the terminal and reading stdin while the editor (e.g. nvim) is running. This causes screen corruption and intermittent keystroke loss (Escape, ZZ), so the prompt is sometimes not captured on return.
This is not specific to the kitty keyboard protocol — it reproduces in wezterm, ghostty, alacritty, and kitty.
Reproduction
- Run
cmdin any of the terminals above. - Type a prompt, press Ctrl+G to open the external editor (nvim).
- Type text, idle ~5s, type more, idle ~5s, then
ZZ. - Observe: typed text often does not appear in nvim;
ZZmay not register; nvim can hang ("Save and close the editor to continue...").
Evidence (cmd vs pi, side-by-side)
Captured in tmux (same terminal, same nvim config). pi calls tui.stop() before spawning the editor and tui.start() after; cmd does not.
| Tool | nvim opened | typing registered | survived idle | ZZ exited | text captured |
|---|---|---|---|---|---|
| pi (reference) | YES | YES | YES | YES | YES |
| cmd | YES | NO (buffer stayed empty) | n/a | NO (stuck) | NO |
Root cause
In openInEditor (and openMemoryFileInEditor), cmd wraps the spawn in withLegacyKeyboard, which only pops/pushes the kitty keyboard protocol. It never stops the TUI render loop or stdin handling. Contrast pi:
this.tui.stop();
try {
let result = await editInExternalEditor({ command, content });
...
} finally {
this.tui.start();
this.tui.requestRender(true);
}
Because cmd's TUI keeps rendering and reading stdin, keystrokes are consumed and the screen is corrupted while nvim is active.
Suggested fix
Mirror pi: before spawning the external editor, stop the TUI (stop rendering + release stdin); after the editor exits, restart the TUI and request a full render. This is the same pattern opencode uses.
nvim-side mitigations already applied (insufficient)
- Disabled
folke/noice.nvim(fixed nvim freeze on exit after idle). ttimeout = true,ttimeoutlen = 0(helps Escape registration).
These address nvim-specific issues but cannot fix a parent TUI that keeps writing to the terminal / reading stdin. Screen corruption and text-capture loss remain until cmd hides its TUI.
Environment
- Command Code v1.88.2
- nvim 0.12.6
- Reproduced in wezterm, ghostty, alacritty, kitty
- 主要言語
- 言語のデータがありません
- スター
- 4.2k
- フォーク
- 377
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 6
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CommandCodeAI/command-code のほかの issue
-
Provider /v1/messages rejects role:"system" inside messages[] — Claude Code ≥ 2.1.154 incompatibleオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
CommandCodeAI/command-code#1085 ·
メンテナーはふだん 1 日以内に返信
-
Feature request: auto-reconnect remote control (/rc) after restart対応中かも @aliarain が 20 日前に担当しました。 オープンp2
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
CommandCodeAI/command-code#992 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
CommandCodeAI/command-code#933 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
CommandCodeAI/command-code#855 ·
メンテナーはふだん 1 日以内に返信
-
grep tool passes empty file type to ripgrep対応中かも @ahmadbilaldev が 19 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
CommandCodeAI/command-code#655 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
CommandCodeAI/command-code の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
FinanceFlash/unvibecode#675 ·
メンテナーはふだん 1 日以内に返信
-
area:tui bug platform:macos
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
anthropics/claude-code#109005 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
criticalmanufacturing/cli#909 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
vercel-labs/just-bash#756 ·
メンテナーはふだん 1 日以内に返信