Rust TUI clips message instead of wrapping or providing horizontal scroll

Resolved 💬 2 comments Opened May 8, 2025 by bolinfest Closed May 19, 2025
💡 Likely answer: A maintainer (bolinfest, collaborator) responded on this thread — see the highlighted reply below.

What version of Codex is running?

_No response_

Which model were you using?

_No response_

What platform is your computer?

_No response_

What steps can reproduce the bug?

Have a conversation in the Rust TUI that causes lines longer than the viewable width. The content is clipped and the only way to see it is to make your terminal window wider.

What is the expected behavior?

Ideally, the content would wrap, but not in a way that breaks scrolling.

What do you see instead?

_No response_

Additional information

https://github.com/openai/codex/pull/868 fixed scrolling but broke wrapping.

View original on GitHub ↗

2 Comments

bolinfest collaborator · 1 year ago

Thinking about this more, I think the problem is mainly when scroll_position is usize::MAX (i.e., keep the scroll pinned to the bottom as new events come in). In that mode, we walk backwards from the end of the list of lines to compute the "visible lines":

https://github.com/openai/codex/blob/27198bfe11bd1f909c9ed0b17f923b04b53c2785/codex-rs/tui/src/conversation_history_widget.rs#L346-L354

Consider a scenario where:

  • The conversation history was 100 lines
  • The viewport was 10 lines
  • Scroll is supposed to pin to the bottom
  • Therefore, we try to show lines 91-100

If any of lines 91-99 wrap, then line 100 would get pushed below the fold and the user would not be able to scroll to it because ConversationHistoryWidget already thinks it is scrolled all the way to the bottom.

bolinfest collaborator · 1 year ago