Просмотр исходного кода

fix: classification width should be taken into account with -F=auto

Terts Diepraam 2 лет назад
Родитель
Сommit
626eb34df2
1 измененных файлов с 11 добавлено и 9 удалено
  1. 11 9
      src/output/grid.rs

+ 11 - 9
src/output/grid.rs

@@ -48,15 +48,17 @@ impl<'a> Render<'a> {
             let filename = self.file_style.for_file(file, self.theme);
 
             // Calculate classification width
-            let classification_width =
-                if let Classify::AddFileIndicators = filename.options.classify {
-                    match filename.classify_char(file) {
-                        Some(s) => s.len(),
-                        None => 0,
-                    }
-                } else {
-                    0
-                };
+            let classification_width = if matches!(
+                filename.options.classify,
+                Classify::AddFileIndicators | Classify::AutomaticAddFileIndicators
+            ) {
+                match filename.classify_char(file) {
+                    Some(s) => s.len(),
+                    None => 0,
+                }
+            } else {
+                0
+            };
             let space_filename_offset = match self.file_style.quote_style {
                 QuoteStyle::QuoteSpaces if file.name.contains(' ') => 2,
                 QuoteStyle::NoQuotes => 0,