radicle-heartwood-lfs/crates/radicle-term/src
Richard Levitte ee17109501 Fix NO_COLOR to only suppress colors, not all ANSI styles
The NO_COLOR convention (https://no-color.org) only calls for
suppressing ANSI *color* codes. It does not demand the removal of
other attributes such as bold, italic, underline or reverse.

Previously, Paint::is_enabled() bundled anstyle_query::no_color()
into the single boolean that decides whether to emit any formatting.
Because Paint relies on that boolean alone, NO_COLOR ended up
stripping bold, italic, reverse, etc. alongside the color codes.
That conflates two concerns: terminal styling support and color
suppression. It is also contrary to the intent of the standard.

Instead, treat the general style decision separately from the
color decision.  Remove the no_color() check from is_enabled()
and add Paint::is_styling_enabled() for the coarse terminal gate.
Style::fmt_prefix and fmt_suffix now query NO_COLOR directly and
conditionally drop foreground and background codes while preserving
non-colour properties.  This way bold, italic, underline and the
like continue to work when NO_COLOR is set, while colors alone are
suppressed.

Closes: rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5/cob/xyz.radicle.issue/f922d90
Assisted-by: Pi:deepinfra/moonshotai/Kimi-K2.6
Signed-off-by: Richard Levitte <richard@levitte.org>
2026-06-23 17:23:36 +01:00
..
ansi Fix NO_COLOR to only suppress colors, not all ANSI styles 2026-06-23 17:23:36 +01:00
ansi.rs rust/edition/fmt: 2021 → 2024 2026-03-30 16:57:51 +02:00
args.rs refactor: Replace return Err(anyhow!()) with anyhow::bail!() 2025-08-17 20:17:11 +02:00
cell.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
colors.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
editor.rs rust/msrv: 1.85.0 → 1.88.0 2026-05-11 11:23:18 +01:00
element.rs term: Catch EPIPE and swallow 2026-04-29 10:57:24 +02:00
format.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
hstack.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
io.rs term: Remove typing indication for passwords 2026-06-12 14:21:21 +02:00
label.rs rust/edition/fmt: 2021 → 2024 2026-03-30 16:57:51 +02:00
lib.rs term: Deny `print_stdout` 2026-04-29 10:57:24 +02:00
spinner.rs rust/msrv: 1.85.0 → 1.88.0 2026-05-11 11:23:18 +01:00
table.rs term/table: Add Table::with_opts() to set options after Table obj was constructed 2025-09-10 21:23:30 +02:00
textarea.rs rust/edition/fmt: 2021 → 2024 2026-03-30 16:57:51 +02:00
vstack.rs term: Rename `Row::Divid{i,}er` 2026-04-30 15:49:57 -04:00