diff --git a/src/view/markdown.rs b/src/view/markdown.rs index 1d5a0c2..69062ac 100644 --- a/src/view/markdown.rs +++ b/src/view/markdown.rs @@ -19,21 +19,54 @@ use ratatui::style::{Modifier, Style}; use ratatui::text::Span; use super::theme::Theme; +/// Apply the "tool output" dim/italic style, or pass `style` through +/// unchanged, depending on `dim`. +fn apply_dim(style: Style, dim: bool) -> Style { + if dim { + Style::default().fg(Theme::TEXT_DIM).add_modifier(Modifier::ITALIC) + } else { + style + } +} + +/// Classify a single line inside a ` ```diff ` fenced block by its unified-diff +/// prefix, returning the color it should always render with (even when the +/// surrounding tool output is dimmed) — or `None` for context lines and the +/// `+++`/`---` file-header lines, which use the normal code-block color. +fn diff_line_style(line: &str) -> Option