From b170396fc7de3c2a431628a97f8281652d614e5f Mon Sep 17 00:00:00 2001 From: sharkdp Date: Sun, 14 May 2017 22:06:15 +0200 Subject: [PATCH] Another small fix for the ANSI regex --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index e90e0c8..5c8a35e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -148,7 +148,7 @@ fn parse_dircolors(path: &Path) -> std::io::Result { .unwrap(); let pattern_ansi = - Regex::new(r"^\.([A-Za-z0-9]+)\s*(?:([0-9][0-9]);)?([0-9][0-9])\b") + Regex::new(r"^\.([A-Za-z0-9]+)\s*(?:([0-9]+);)?([0-9][0-9])\b") .unwrap(); for line in BufReader::new(file).lines() { @@ -178,8 +178,11 @@ fn parse_dircolors(path: &Path) -> std::io::Result { let style_s = caps.get(2) .map_or("", |m| m.as_str()); let style = match style_s { + "1" => color.bold(), "01" => color.bold(), + "3" => color.italic(), "03" => color.italic(), + "4" => color.underline(), "04" => color.underline(), _ => color.normal() };