fix: use pterm open to eliminate snapshot timing gap in :Pterm command#12
Merged
fix: use pterm open to eliminate snapshot timing gap in :Pterm command#12
Conversation
When :Pterm created a session via the two-step flow (vim.fn.system for `pterm new` → wait_for_socket → jobstart for `pterm attach`), the shell had time to produce PTY output during the gap. On bridge connection, server.rs flush_pty_output() triggered snapshot delivery at the old 80×24 size BEFORE the client's RESIZE was processed, leaving libvterm with wrong scroll regions and causing progressive display corruption. CLI `pterm open` was unaffected because it handles creation and bridge attachment in a single process with minimal delay. Changes: - init.lua: M.open() now uses `pterm open` via jobstart instead of the two-step `pterm new` + `pterm attach`, matching the stable CLI flow - init.lua: extract start_terminal() helper shared by M.open/M.attach - init.lua: remove unused wait_for_socket() and attach_wait_ms/poll_ms config fields - main.rs: add quiet parameter to cmd_new() to suppress JSON metadata output when called from cmd_open, preventing leakage into the Neovim terminal buffer Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
:Ptermコマンドで作成したターミナルの表示が崩れる問題を修正pterm new→wait_for_socket→pterm attach) のタイミングギャップにより、bridge 接続時にflush_pty_output()が RESIZE 処理前に 80x24 サイズのスナップショットを送信し、libvterm のスクロール領域が不正になっていたpterm openを jobstart で直接実行する 1 ステップフローに変更し、CLI と同一の安定したパスを使用cmd_new()にquietパラメータを追加し、cmd_open経由での JSON 出力漏れを防止Test plan
:Ptermで新規セッション作成 → プロンプト表示が正常であること:Ptermで Enter/文字入力 → 表示が崩れないこと:Pterm session_name -- commandでカスタムコマンド実行が動作すること:Pterm再接続が動作することpterm openCLI からの実行が引き続き正常であることcargo checkがパスすること🤖 Generated with Claude Code