Skip to content

fix: set alt_screen_enabled before resume/fork pickers run - #9258

Closed
hjanuschka wants to merge 1 commit into
openai:mainfrom
hjanuschka:fix/alt-screen-ordering-9115
Closed

hjanuschka wants to merge 1 commit into
openai:mainfrom
hjanuschka:fix/alt-screen-ordering-9115

Conversation

@hjanuschka

Copy link
Copy Markdown
Contributor

Summary

The alt_screen_enabled flag was being set AFTER resume_picker and fork_picker ran, which meant those overlays would enter alternate screen even when --no-alt-screen was passed or when running in Zellij with auto-detection.

This moves the set_alt_screen_enabled() call to immediately after Tui::new(), before any pickers or overlays run, ensuring all enter_alt_screen() calls respect the setting.

Before (broken order):

  1. Tui::new() - alt_screen_enabled defaults to true
  2. resume_picker::run_resume_picker() - enters alt screen (ignores flag!)
  3. tui.set_alt_screen_enabled(false) - too late

After (fixed order):

  1. Tui::new() - alt_screen_enabled defaults to true
  2. tui.set_alt_screen_enabled(use_alt_screen) - set flag early
  3. resume_picker::run_resume_picker() - respects flag

Fixes #9115

Test plan

  • Run codex --no-alt-screen in Zellij and verify scrollback works
  • Run codex resume in Zellij and verify the picker also respects the setting
  • Run codex in a normal terminal and verify alternate screen still works

The alt_screen_enabled flag was being set AFTER resume_picker and
fork_picker ran, which meant those overlays would enter alternate
screen even when --no-alt-screen was passed or when running in Zellij.

This moves the set_alt_screen_enabled() call to immediately after
Tui::new(), before any pickers or overlays run, ensuring all
enter_alt_screen() calls respect the setting.

Fixes openai#9115
@etraut-openai

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 764d79ad0f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/tui/src/lib.rs Resolved
Comment thread codex-rs/tui2/src/lib.rs Resolved
@etraut-openai

etraut-openai commented Jan 15, 2026 •

Copy link
Copy Markdown
Contributor

@hjanuschka thanks for the contribution. Please take a look at the code review feedback from Codex.

@etraut-openai etraut-openai added the needs-response Additional information is requested label Jan 15, 2026
@hjanuschka

Copy link
Copy Markdown
Contributor Author

Re: the P2 comments about recomputing alt-screen after config reload -

Once the TUI has started in either mode (alt-screen or inline), switching mid-session isn't possible - the terminal state is committed and content may already be in scrollback. The early flag setting affects pickers/overlays, and by the time config reload happens after trust, we're already committed to whichever mode we started with.

This is a theoretical edge case that doesn't affect real-world usage. Happy to add the recompute if you prefer, but wanted to note it's mostly theoretical.

@etraut-openai etraut-openai removed the needs-response Additional information is requested label Jan 16, 2026
@joshka-oai

Copy link
Copy Markdown
Contributor

This is a theoretical edge case that doesn't affect real-world usage. Happy to add the recompute if you prefer, but wanted to note it's mostly theoretical.

agreed

@hjanuschka

Copy link
Copy Markdown
Contributor Author

ok after alot of testing, i am still working on a proper fix, tui2 works flawless, will continue over the weekend to figure out a fix for legacy tui! @etraut-openai can you put this on "on-hold" or somehow merge block?

@etraut-openai

Copy link
Copy Markdown
Contributor

Thanks @hjanuschka! Can you set the PR to "draft" status in the meantime?

@hjanuschka
hjanuschka marked this pull request as draft January 16, 2026 07:31
@etraut-openai etraut-openai added the needs-response Additional information is requested label Jan 20, 2026
@etraut-openai

Copy link
Copy Markdown
Contributor

@hjanuschka, checking in with you to see if you're making progress or anticipate having time to work on this soon? If not, we will close it for now.

@hjanuschka

hjanuschka commented Jan 21, 2026 •

Copy link
Copy Markdown
Contributor Author

been playing around with it, works in flawless in tui2 but not in tui1, i just cant get it to work :(
sorry for that, would really appreciate any help from oai's team.

@etraut-openai

Copy link
Copy Markdown
Contributor

@hjanuschka, FYI, we've decided to abandon the tui2 approach. That tui2 code is removed from the main branch.

@etraut-openai

Copy link
Copy Markdown
Contributor

I'm going to close the PR. If you want to pick it up again, we can reopen.

@guysrd

guysrd commented Mar 17, 2026

Copy link
Copy Markdown

hi @etraut-openai , do you have a solution for this issue?
does my analysis (#9115 (comment)) make any sense to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-response Additional information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zellij Incompatibility

4 participants