@@ -921,29 +921,22 @@ maya::Cmd<Msg> finalize_turn(Model& m, StopReason stop_reason) {
921921 // canvas resizes to fit total transcript height and every
922922 // render clears + paints all of it.
923923 //
924- // Either way, absorb the freeze-seam height delta with
925- // commit_scrollback_overflow. At this instant the live tail's
926- // last run loses its reserved indicator/spacer slot
927- // (reserve_slot = active() && is_last_run flips false now that
928- // phase==Idle) AND its markdown just settled via finish() above,
929- // so the run's row count differs from the previous (streaming)
930- // frame by ±N rows. maya's inline diff compares new-vs-prev: a
931- // row-count change in the live tail shifts every row below it and
932- // the visible viewport gets re-emitted — the "whole scrollback
933- // re-renders at turn end" flicker. commit_scrollback_overflow
934- // re-bases prev_cells (drops max(0, prev_rows - term_h), zero
935- // wire bytes) so the next diff measures the settled frame against
936- // a clean baseline instead of scrolling on-screen rows. The
937- // trim path already issues it; the non-trim path needs it too
938- // because the seam delta exists whether or not we trimmed. Fold
939- // it into `kp` here so the post-turn auto-compaction check below
940- // still runs.
924+ // commit_scrollback_overflow goes ONLY on the trim path. Trim
925+ // actually removes entries from the frozen tree, so committing
926+ // the overflowed rows to native scrollback matches a real
927+ // shrink of the live tree — the next diff measures the smaller
928+ // settled frame against a baseline that lost the same rows.
929+ // The non-trim path must NOT commit: there the frozen tree
930+ // still owns every visible row, so committing overflow rebases
931+ // prev_cells without a matching tree shrink — the next render's
932+ // canvas grows back to full height and the diff re-emits the
933+ // committed rows, fighting the rebase every frame (visible as
934+ // heavy flicker / stuck redraws). The freeze-seam height delta
935+ // on the non-trim path is small (±N live-tail rows) and the
936+ // normal new-vs-prev diff absorbs it on its own.
941937 if (auto trim = trim_frozen_if_oversized (m); !trim.is_none ()) {
942938 kp = Cmd<Msg>::batch (std::vector<Cmd<Msg>>{
943939 std::move (trim), std::move (kp)});
944- } else {
945- kp = Cmd<Msg>::batch (std::vector<Cmd<Msg>>{
946- maya::Cmd<Msg>::commit_scrollback_overflow (), std::move (kp)});
947940 }
948941 }
949942
0 commit comments