From ade9babee1fda207ea560c469b1c8876c732e729 Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Sat, 20 Jun 2026 22:51:28 +0800 Subject: [PATCH] =?UTF-8?q?revert:=20=E7=A7=BB=E9=99=A4=E4=B8=BB=E5=B1=8F?= =?UTF-8?q?=E5=B9=95=E5=91=A8=E6=9C=9F=E6=80=A7=20self-healing=20=E9=87=8D?= =?UTF-8?q?=E7=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 回退 f69c7051 中引入的 ink.tsx self-healing 机制(lastMainScreenHealTime 字段 + 每 5 秒触发全量重绘 + needsEraseBeforePaint 主屏幕分支)。该机制在 workflow 面板持续刷新场景下表现为可见的"重复刷新",且修复效果不稳定。 alt-screen 的 needsEraseBeforePaint 路径和 prevFrameContaminated 字段保留, 它们仍服务于 handleResize / layout shift / selection 高亮。 Co-Authored-By: glm-5.2 --- packages/@ant/ink/src/core/ink.tsx | 31 ------------------------------ 1 file changed, 31 deletions(-) diff --git a/packages/@ant/ink/src/core/ink.tsx b/packages/@ant/ink/src/core/ink.tsx index 37d3a91c7..60da7d94d 100644 --- a/packages/@ant/ink/src/core/ink.tsx +++ b/packages/@ant/ink/src/core/ink.tsx @@ -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 | 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