//! Per-thread persistent style state.
//!
//! Style "bleed" calls (e.g. cprintb!) intentionally don't reset at the end,
//! so subsequent calls see the leftover ANSI styles in the terminal. To handle
//! `[/red]`-style targeted resets correctly across calls, we persist the
//! active style stack between renders.
//!
//! Per-thread because terminal output is inherently per-thread state — two
//! threads writing to the same stdout are already racing; they shouldn't also
//! be racing over style state.
use RefCell;
use crateTagType;
thread_local!
/// Returns a clone of the current persisted stack.
/// Used by the parser at the start of `render` to resume from prior state.
/// Replaces the persisted stack.
/// Used by the parser at the end of `render` to save its working state.
/// Clears the persisted stack.
/// Called by the upper layer after a non-bleed print (which appends \x1b[0m,
/// so the terminal is back to a clean slate).