diff --git a/src/app/browser/window/tab/item/page/content/text/gemini/reader/ansi.rs b/src/app/browser/window/tab/item/page/content/text/gemini/reader/ansi.rs index 5f5df5e5..803ec0e3 100644 --- a/src/app/browser/window/tab/item/page/content/text/gemini/reader/ansi.rs +++ b/src/app/browser/window/tab/item/page/content/text/gemini/reader/ansi.rs @@ -12,14 +12,15 @@ pub fn format(source_code: &str) -> Vec<(TextTag, String)> { let mut tag = Tag::new(); for ref entity in source_code.ansi_parse() { - if let Output::Escape(AnsiSequence::SetGraphicsMode(colors)) = entity { - if colors.len() == 1 { - } else if colors[0] == 38 { - tag.text_tag - .set_foreground_rgba(rgba::default(*colors.last().unwrap()).as_ref()); - } else { - tag.text_tag - .set_background_rgba(rgba::default(*colors.last().unwrap()).as_ref()); + if let Output::Escape(AnsiSequence::SetGraphicsMode(color)) = entity { + if color.len() > 1 { + if color[0] == 38 { + tag.text_tag + .set_foreground_rgba(rgba::default(*color.last().unwrap()).as_ref()); + } else { + tag.text_tag + .set_background_rgba(rgba::default(*color.last().unwrap()).as_ref()); + } } } if let Output::TextBlock(text) = entity {