refactor(engine): take the TERM=dumb answer from the painter - #1219
Merged
kronberger-droid merged 1 commit intoSep 17, 2026
Merged
kronberger-droid merged 1 commit into
kronberger-droid merged 1 commit into
Conversation
The engine read `TERM` on every paint while the painter answers from a flag cached at construction and on resize, so after a mid-session change the colors and the skipped escapes could disagree. ANSI coloring now follows that cache too, thus it no longer tracks `TERM` between resizes. Follow-up to nushell#1183.
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.
Summary
Follow-up to #1183.
Paintercaches whetherTERM=dumbat construction and on resize, butReedline::effective_ansi_coloringstill readTERMfrom the environment on every paint.Two answers to the same question, thus after a mid-session change of
TERMthe colors and the escapes the painter skips could disagree.The engine now asks the painter through a
pub(crate)term_is_dumb()accessor.term_supports_ansihas no caller left and is gone, its tests now pinterm_is_dumbdirectly.prompt/default.rsimportsvar_osinstead of spelling the path twice, which was still open from the #1183 review.No public API change.
Before
ANSI coloring followed
TERMon every paint.After
ANSI coloring follows the painter's flag, so it picks up a changed
TERMonly on resize, same as everything else under the dumb policy.