Respect terminal width

Resolved 💬 9 comments Opened Aug 8, 2025 by aehlke Closed Dec 31, 2025
💡 Likely answer: A maintainer (easong-openai, contributor) 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?

Resize terminal while running

What is the expected behavior?

_No response_

What do you see instead?

_No response_

Additional information

_No response_

View original on GitHub ↗

9 Comments

EspenG · 11 months ago

```diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rs
index 86d74141..99bfdff3 100644
--- a/codex-rs/tui/src/app.rs
+++ b/codex-rs/tui/src/app.rs
@@ -496,6 +496,8 @@ impl App<'_> {
}
terminal.draw(|frame| match &mut self.app_state {
AppState::Chat { widget } => {

  • // Keep live streaming overlay wrapping in sync with current width
  • widget.update_live_width(frame.area());

if let Some((x, y)) = widget.cursor_pos(frame.area()) {
frame.set_cursor_position((x, y));
}
diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs
index 8a47353c..55007cfe 100644
--- a/codex-rs/tui/src/chatwidget.rs
+++ b/codex-rs/tui/src/chatwidget.rs
@@ -110,6 +110,15 @@ fn create_initial_user_message(text: String, image_paths: Vec<PathBuf>) -> Optio
}

impl ChatWidget<'_> {

  • /// Ensure the live row builder width matches the current bottom pane width
  • /// so streamed output wraps at the correct terminal width.
  • pub(crate) fn update_live_width(&mut self, area: Rect) {
  • let [_, bottom_pane_area] = self.layout_areas(area);
  • let target = bottom_pane_area.width.max(1) as usize;
  • if self.live_builder.width() != target {
  • self.live_builder.set_width(target);
  • }
  • }

fn interrupt_running_task(&mut self) {
if self.bottom_pane.is_task_running() {
self.active_history_cell = None;```

imajes · 11 months ago

Came here to say this also -- the hard wrap at 80 is not pleasant to work with, especially as it cuts words.

imajes · 11 months ago

@EspenG your patch won't cleanly apply as there have been other changes that mess with the index/diff line number markers.

However, i am testing it and it does make it go full with, which is great... though personally i'd prefer some padding (and also not wrapping/breaking words :/)

I wonder if the @openai folk are intending to use the other part of the width for other content?

easong-openai contributor · 11 months ago

We're working on supporting full width with word wrap!

imajes · 11 months ago

@easong-openai I saw that pr landed and was reverted -- looking forward to seeing how that improves things. :)

_ideally_ it'd be nice if it were possible to set a max width or similar in config - because the output is to be read, it's might be nice not to always have it super wide, without having to change the actual terminal itself.

easong-openai contributor · 11 months ago

Agree! I use an iterm hotkey window on a 32 inch monitor and the full-terminal line wrapping is more than a little silly there. I think this is an improvement for enough users that we should add that in a later release.

callmemorgan · 11 months ago

@easong-openai I was working on a similar PR, but figured I should see if the issue was even open. Very excited to hear!

Curious to see how my work differs when support lands.

Do you plan on doing line-breaks on syllables / phonemes, or just a hard column cutoff like currently?

rahulrajaram · 11 months ago

Just saw this issue. I was fixing the markdown render bug in the Rust CLI and realized that there is overlap with the lack of soft-wrap, so I fixed them both together: https://github.com/openai/codex/pull/2143 😃

etraut-openai contributor · 6 months ago

This feature hasn't received any upvotes or new posts in a long time, so I'm going to close it out.

We are actively exploring alternative terminal UI update mechanisms that would address this issue, but these alternative approaches have other tradeoffs. There's no solution that will address all terminal-related problems like this.