cli: display.Mode always resolves to the mode actually rendered - #14103
Merged
Conversation
The display.Mode package global was left as "auto" on the most common path (auto mode with an interactive or redirected terminal), so readers like `up`'s NavigationMenu gate saw an unresolved value; that gate also compared against the string literal "plain" instead of the constant. applyDisplayMode wrote a mode that selectEventProcessor could then contradict (--ansi always with a redirected stderr rendered Plain while Mode said tty). selectEventProcessor becomes the single resolution point: every branch assigns the mode matching the renderer it returns, so after command setup the global never holds ModeAuto. applyDisplayMode loses its redundant writes and its misleading name (now applyAnsiMode); the contract is documented on the Mode variable, and the existing selectEventProcessor tests now pin the resolved mode for every branch. Side effect, deliberate: with stderr redirected (auto -> plain rendering) the navigation menu is no longer offered; it used to slip through because Mode still read "auto". Part of #14074 (section E). Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
39 tasks
glours
approved these changes
Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
display.Modestayed"auto"on the most common path (auto progress mode), so readers such asup's NavigationMenu gate acted on an unresolved value — and that gate compared against the literal"plain"instead of the constant.applyDisplayModecould also write a mode the renderer selection then contradicted (--ansi always+ redirected stderr rendered Plain whileModesaidtty).selectEventProcessoris now the single resolution point: every branch assigns the mode matching the renderer it returns, so after command setup the global never holdsModeAuto.applyDisplayModeloses its redundant writes and its misleading name (applyAnsiMode); the contract is documented on theModevariable and pinned by the existingTestSelectEventProcessor_*tables, which now assert the resolved mode per branch.Deliberate behavior change: with stderr redirected (auto → plain rendering), the interactive navigation menu is no longer offered; it used to slip through because
Modestill read"auto".Part of #14074 (section E).
🤖 Generated with Claude Code