anomalyco / anomalyco/opencode

--mini wipes scrollback and replays the whole session on every terminal resize

Open
#37,971 3 comments 0 reactions 1 assignee View on GitHub

@simonklee is already working on this.

Since Jul 22, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

Resizing the terminal in --mini (tmux pane split, window drag, any SIGWINCH) makes the UI:

  • wipe the screen and the terminal's saved scrollback (ESC[2J+ESC[3J)
  • refetch the whole session from the server
  • reprint every message from the beginning

Every resize re-scrolls the entire session. Scroll position is lost, along with any scrollback from before opencode started.

A second bug hides under it: widen the terminal while a response is streaming and the output after the resize is silently dropped (scrollback entries commit by layout row; the old row offset is invalid at the new width).

The reprint exists to re-wrap history at the new width. Only terminals that don't reflow scrollback themselves need that: plain xterm, and partially GNU screen. Everything modern reflows on its own, so by default everyone else pays the wipe-and-reprint for nothing.

Fix available: make resize replay opt-in, resume replay unchanged. #37973 (dev), #37974 (v2 port).

Reflow behavior by terminal, local measurements use a cursor-position probe (print a 150-char line, record cursor row;col via CSI 6n, resize, record again; a reflowing terminal moves the cursor to the re-wrapped position):

Terminal Reflows on resize? Verified by
xterm (patch 378) No: cursor frozen through both resizes (2;51→2;51, 3;31→3;31) measured (headless Xvfb); FAQ documents no reflow feature
GNU screen 4.00.03 Partial: re-wraps the active line only measured
tmux 3.6 Yes (2;51→2;31, 3;31→2;51) measured; tmux#1269
VTE (GNOME Terminal, xfce4-terminal) Yes, since VTE 0.36 / GNOME 3.12 (2014) GNOME/vte#135
Konsole Yes (default on), since 21.04 KDE blog, bug 196998
Windows conhost Yes, "Wrap text output on resize", default on since Windows 10 Windows Dev Blog 2014
Windows Terminal Yes microsoft/terminal#4741
alacritty Yes, since 0.3.0 changelog
kitty, ghostty, iTerm2, Terminal.app Yes maintainer threads; no primary source for the last two
Plugins

none

OpenCode version

v1.18.0 (mechanism also present on the v2 branch in packages/tui/src/mini/)

Steps to reproduce
  1. Resume a long session: opencode --mini -s <session> (or --continue)
  2. Resize the terminal: split a tmux pane or drag the window
  3. The whole session re-scrolls past; tmux display -p '#{history_size}' shows pane scrollback wiped to 0 and rebuilt; tmux pipe-pane shows ESC[2J+ESC[3J emitted per resize
Screenshot and/or share link

resize wipes and replays the session

Operating System

macOS 14 (Darwin 23.6)

Terminal

tmux 3.6 (any terminal; easiest to see under tmux)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.