throughline 0.3.7 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "throughline",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "type": "module",
5
5
  "description": "Claude Code hooks plugin for structured context compression (/clear-safe persistent memory)",
6
6
  "keywords": [
@@ -420,13 +420,20 @@ function renderFrame(args) {
420
420
  const columns = resolveColumns();
421
421
  const clipped = lines.map((l) => truncateToCells(l, columns));
422
422
 
423
- // 前フレームを消去してから再描画:
424
- // 1. カーソルを前フレームの先頭行へ戻す (CUU = 行移動のみ)
425
- // 2. 1 へ戻す (CR)
426
- // 3. 現在位置から画面末尾までを一括消去 (ED 0)
427
- // CPL (\x1b[nF) は VSCode 統合ターミナルで挙動が不安定だったため使わない
428
- if (lastRenderedLines > 0) {
429
- process.stdout.write(ANSI.up(lastRenderedLines) + '\r' + ANSI.clearBelow);
423
+ // 再描画戦略:
424
+ // - TTY: 真の columns が分かるので CUU + clearBelow で部分再描画(省フリッカ)
425
+ // - TTY (VSCode の type:process タスク等): columns を信用できないので 200 で
426
+ // truncate しているが、実ターミナル幅が 200 未満なら自動改行が起き、論理行数と
427
+ // 物理行数がズレて CUU が誤作動する(「1 セッション」行が毎フレーム積み上がる
428
+ // バグを実機で確認)。非 TTY では画面全クリアで愚直に描き直す方が確実。
429
+ // どちらも差分検知 (needsRerender) を通過したフレームのみ書き込むので、
430
+ // フリッカ量はデータ変化頻度に比例するだけで爆発しない。
431
+ if (process.stdout.isTTY) {
432
+ if (lastRenderedLines > 0) {
433
+ process.stdout.write(ANSI.up(lastRenderedLines) + '\r' + ANSI.clearBelow);
434
+ }
435
+ } else {
436
+ process.stdout.write(ANSI.clearScreen);
430
437
  }
431
438
 
432
439
  process.stdout.write(clipped.join('\n') + '\n');