revert: 移除主屏幕周期性 self-healing 重绘

回退 f69c7051 中引入的 ink.tsx self-healing 机制(lastMainScreenHealTime 字段
+ 每 5 秒触发全量重绘 + needsEraseBeforePaint 主屏幕分支)。该机制在 workflow
面板持续刷新场景下表现为可见的"重复刷新",且修复效果不稳定。

alt-screen 的 needsEraseBeforePaint 路径和 prevFrameContaminated 字段保留,
它们仍服务于 handleResize / layout shift / selection 高亮。

Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
This commit is contained in:
claude-code-best
2026-06-20 22:51:28 +08:00
parent f47ba3b5de
commit ade9babee1

View File

@@ -165,12 +165,6 @@ export default class Ink {
private frontFrame: Frame;
private backFrame: Frame;
private lastPoolResetTime = performance.now();
/** Timestamp of last periodic full-redraw in main screen mode. Used to
* recover from accumulated cursor drift / blit ghosting. Wall-clock
* based (not frame-count) so drain scroll frames (250fps) don't
* accelerate the cycle. Alt-screen doesn't need this — CSI H resets
* cursor every frame. */
private lastMainScreenHealTime = performance.now();
private drainTimer: ReturnType<typeof setTimeout> | null = null;
private lastYogaCounters: {
ms: number;
@@ -527,25 +521,7 @@ export default class Ink {
// an extra React re-render cycle.
this.options.onBeforeRender?.();
// Periodic self-healing: every ~5s in main screen mode, force a full
// terminal redraw to recover from accumulated cursor drift / blit
// ghosting. Alt-screen doesn't need this — CSI H resets cursor to
// (0,0) every frame. Wall-clock based so drain scroll frames (250fps)
// don't accelerate the cycle. Guarded by isTTY so ANSI escape
// sequences are not leaked into pipes / redirected output.
const renderStart = performance.now();
if (
!this.altScreenActive &&
!this.isPaused &&
this.options.stdout.isTTY &&
renderStart - this.lastMainScreenHealTime > 5000
) {
this.lastMainScreenHealTime = renderStart;
this.repaint();
this.prevFrameContaminated = true;
this.needsEraseBeforePaint = true;
}
const terminalWidth = this.options.stdout.columns || 80;
const terminalRows = this.options.stdout.rows || 24;
@@ -780,13 +756,6 @@ export default class Ink {
optimized.unshift(CURSOR_HOME_PATCH);
}
optimized.push(this.altScreenParkPatch);
} else if (this.needsEraseBeforePaint && hasDiff) {
// Main-screen periodic self-healing: clear visible terminal before
// painting the diff. Without this, rows past the new frame's height
// would retain stale content from the previous frame. BSU/ESU keeps
// old content visible until the full erase+paint is flushed atomically.
this.needsEraseBeforePaint = false;
optimized.unshift(ERASE_THEN_HOME_PATCH);
}
// Native cursor positioning: park the terminal cursor at the declared