Explorar el Código

Give control characters their own colour

Benjamin Sago hace 8 años
padre
commit
4249cf0fcc
Se han modificado 2 ficheros con 4 adiciones y 2 borrados
  1. 3 1
      src/output/colours.rs
  2. 1 1
      src/output/mod.rs

+ 3 - 1
src/output/colours.rs

@@ -22,6 +22,7 @@ pub struct Colours {
     pub symlink_path:     Style,
     pub symlink_path:     Style,
     pub broken_arrow:     Style,
     pub broken_arrow:     Style,
     pub broken_filename:  Style,
     pub broken_filename:  Style,
+    pub control_char:     Style,
 }
 }
 
 
 #[derive(Clone, Copy, Debug, Default, PartialEq)]
 #[derive(Clone, Copy, Debug, Default, PartialEq)]
@@ -170,7 +171,8 @@ impl Colours {
 
 
             symlink_path:     Cyan.normal(),
             symlink_path:     Cyan.normal(),
             broken_arrow:     Red.normal(),
             broken_arrow:     Red.normal(),
-            broken_filename:  Red.underline()
+            broken_filename:  Red.underline(),
+            control_char:     Red.normal(),
         }
         }
     }
     }
 
 

+ 1 - 1
src/output/mod.rs

@@ -126,7 +126,7 @@ fn coloured_file_name<'a>(file: &File, colours: &Colours) -> Vec<ANSIString<'a>>
                 bits.push(colour.paint(s));
                 bits.push(colour.paint(s));
             } else {
             } else {
                 let s = c.escape_default().collect::<String>();
                 let s = c.escape_default().collect::<String>();
-                bits.push(colours.broken_arrow.paint(s));
+                bits.push(colours.control_char.paint(s));
             }
             }
         }
         }
     }
     }