Preserve viewport/context when exiting transcript overlay
Resolved 💬 6 comments Opened Mar 9, 2026 by dikelps Closed May 31, 2026
What variant of Codex are you using?
CLI
What feature would you like to see?
Exiting transcript mode currently leaves me disoriented because the main TUI appears reset/cleared and the composer is placed at the top, so I lose visual continuity with the conversation I was just reviewing.
Request:
- restore the prior viewport/scroll position when closing transcript mode
- ~~keep the composer in its normal anchored position~~
This is particularly important for long sessions and multi-agent workflows, where user checks different window and need the context for the conversation.
Additional information
_No response_
6 Comments
Analysis
I traced the transcript overlay lifecycle through the TUI code.
How it works today:
codex-rs/tui/src/pager_overlay.rsrenders the transcript overlay (Ctrl+T) with its ownscroll_offset: usize(line 137)codex-rs/tui/src/chatwidget.rsmanages the main conversation scroll state separatelyRoot cause: There's no save/restore of the main viewport's scroll offset around the overlay open/close lifecycle. The overlay has its own scroll state, but the main conversation view's position isn't preserved when the overlay takes over and then releases the terminal.
The scroll infrastructure exists:
codex-rs/tui/src/bottom_pane/scroll_state.rsis a reusableScrollStatemodule used by multiple widgets (list_selection_view, multi_select_picker, file_search_popup, etc.). The chatwidget likely has its own scroll tracking too.Proposed Fix
Save/restore the chatwidget's scroll position around overlay transitions:
This is a small, targeted change - just adding a save field and two assignment points. The scroll offset getter/setter would need to be exposed on the chatwidget if not already public.
This is especially valuable for long sessions and multi-agent workflows (as the reporter notes). Happy to submit a PR if invited.
Just re-rendering the scrollback buffer is a potential solution to this: https://github.com/dagelf/codex/tree/displayfix
Related: #21945 — the transcript overlay has O(n) rendering that rebuilds all cells from scratch on open/close. The viewport disorientation on exit is partly a consequence of this architecture: since the overlay doesn't track a mapping between scroll position and the underlying terminal scrollback, it can't restore viewport position. Virtualized rendering with a spatial index would make viewport preservation tractable.
Closing as now TUI does not clear screen when transcript is toggled.
I ran into the same issue during long terminal sessions, especially when using Codex over SSH and inside tmux.
I implemented a lightweight community fork called Codex Sticky that adds this sticky-on-scroll composer behavior:
https://github.com/Jurio0304/codex-sticky
When scrolling back through older transcript content, the composer remains reachable at the bottom of the terminal. The fork is installed side by side as
codex-sticky, so it does not overwrite the officialcodexcommand.It is currently intended as a small, unofficial workaround for Linux x86_64 users while keeping the experience close to upstream. Feedback is very welcome.
@Jurio0304 I crossed out the anchored composer part from the main content, because it likely is not obvious from the issue title. It will likely require a whole new TUI mode for that so you can open an new topic if needed.