mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:40:43 +00:00
## Why Line-buffered stdout can flush on every newline during a long history replay, turning a batch of history rows into many small terminal writes. ## What changed Use a bounded buffer to group history writes in both standard and full-screen modes. Drain the buffer to the terminal backend without explicitly flushing stdout. ## Testing Add a regression test that inserts 500 rows in each mode and checks that fewer than 50 backend writes contain newlines, the final row appears directly above the viewport, and the cursor returns to its original position. GitOrigin-RevId: c33a13fc71307a3f71be5e266e04c0160c34a8b3