Skip to content

fix: update vt100 0.15 → 0.16 to restore dim (SGR 2) attribute in snapshots#16

Merged
ttak0422 merged 1 commit intomainfrom
fix/update-vt100-0.16
Mar 14, 2026
Merged

fix: update vt100 0.15 → 0.16 to restore dim (SGR 2) attribute in snapshots#16
ttak0422 merged 1 commit intomainfrom
fix/update-vt100-0.16

Conversation

@ttak0422
Copy link
Copy Markdown
Owner

問題

detach → re-attach 時に dim/faint テキスト(SGR 2)の属性が消える。

ライブ出力:  ESC[2mNo ESC[0m   → faint 表示
snapshot:    ESC[m  No          → 通常テキストとして表示(属性消失)

claude yes のような yes/no ダイアログで "No" が faint にならない現象の原因。

原因

vt100 0.15 は dim 属性を完全未実装:

  • attrs.rsTEXT_MODE_DIM ビットなし
  • sgr() ハンドラに &[2] ケースなし → SGR 2 受信時に無視
  • state_formatted() は dim を再生成しない

修正

vt100 0.16 へ更新。0.16 での変更:

  • TEXT_MODE_DIM = 0b0000_0010 を追加
  • sgr()[2] => self.attrs.set_dim() を追加
  • state_formatted()Intensity::DimESC[2m として正しく再出力

API 変更対応

変更前 変更後
screen.errors() 削除(廃止)→ デバッグログから除去
parser.set_size(rows, cols) parser.screen_mut().set_size(rows, cols)

確認方法

byte-level 比較で修正を確認済み(調査ブランチ debug/display-investigation #15 参照):

ORIGINAL:   ESC[2mNo ESC[0m  ← faint
0.15 snap:  ESC[m  No        ← dim 消失
0.16 snap:  ESC[m  ESC[2mNo  ← dim 保持

Test plan

  • nix run .#test-nvim で起動
  • printf '\033[2mfaint text\033[0m\n' を実行
  • detach → re-attach 後も faint 表示が維持されていることを確認

🤖 Generated with Claude Code

…pshots

vt100 0.15 did not track the dim/faint attribute (SGR 2) at all — no
TEXT_MODE_DIM bit and no handler in sgr(). As a result, state_formatted()
never re-emitted ESC[2m, so text rendered as dim in the live session would
appear as normal-weight text after a detach/re-attach cycle.

vt100 0.16 adds TEXT_MODE_DIM and handles SGR 2 → set_dim(), and
state_formatted() correctly re-emits Intensity::Dim as ESC[2m.

Confirmed via byte-level comparison of live PTY output vs snapshot:
  ORIGINAL:  ESC[2mNo ESC[0m  (faint)
  0.15 snap: ESC[m  No        (dim lost)
  0.16 snap: ESC[m  ESC[2mNo  (dim preserved)

API changes in 0.16:
- screen.errors() removed → dropped from debug log format string
- parser.set_size(rows, cols) → parser.screen_mut().set_size(rows, cols)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ttak0422 ttak0422 merged commit f433990 into main Mar 14, 2026
2 checks passed
@ttak0422 ttak0422 deleted the fix/update-vt100-0.16 branch March 14, 2026 09:17
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.

1 participant