Skip to content

refactor(engine): take the TERM=dumb answer from the painter - #1219

Merged
kronberger-droid merged 1 commit into
nushell:mainfrom
kronberger-droid:refactor/term-dumb-single-source
Sep 17, 2026
Merged

kronberger-droid merged 1 commit into
nushell:mainfrom
kronberger-droid:refactor/term-dumb-single-source

Conversation

@kronberger-droid

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #1183.
Painter caches whether TERM=dumb at construction and on resize, but Reedline::effective_ansi_coloring still read TERM from the environment on every paint.
Two answers to the same question, thus after a mid-session change of TERM the 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_ansi has no caller left and is gone, its tests now pin term_is_dumb directly.
prompt/default.rs imports var_os instead of spelling the path twice, which was still open from the #1183 review.

No public API change.

Before

ANSI coloring followed TERM on every paint.

After

ANSI coloring follows the painter's flag, so it picks up a changed TERM only on resize, same as everything else under the dumb policy.

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.
@kronberger-droid
kronberger-droid merged commit e0f1c0b into nushell:main Sep 17, 2026
7 checks passed
@kronberger-droid
kronberger-droid deleted the refactor/term-dumb-single-source branch September 17, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant