Sfoglia il codice sorgente

feat(theme): add IconOverrides struct and UiStyles.icon_overrides

Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
Sandro-Alessio Gierens 1 anno fa
parent
commit
b7ea0b1e2f
2 ha cambiato i file con 14 aggiunte e 0 eliminazioni
  1. 2 0
      src/theme/default_theme.rs
  2. 12 0
      src/theme/ui_styles.rs

+ 2 - 0
src/theme/default_theme.rs

@@ -129,6 +129,8 @@ impl Default for UiStyles {
             control_char: Some(Red.normal()),
             control_char: Some(Red.normal()),
             broken_symlink: Some(Red.normal()),
             broken_symlink: Some(Red.normal()),
             broken_path_overlay: Some(Style::default().underline()),
             broken_path_overlay: Some(Style::default().underline()),
+
+            icon_overrides: None,
         }
         }
     }
     }
 }
 }

+ 12 - 0
src/theme/ui_styles.rs

@@ -1,8 +1,16 @@
 use crate::theme::lsc::Pair;
 use crate::theme::lsc::Pair;
 use nu_ansi_term::{Color::*, Style};
 use nu_ansi_term::{Color::*, Style};
 use serde::{Deserialize, Serialize};
 use serde::{Deserialize, Serialize};
+use std::collections::HashMap;
 use std::default::Default;
 use std::default::Default;
 
 
+#[rustfmt::skip]
+#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
+pub struct IconOverrides {
+    pub filenames: Option<HashMap<String, char>>,
+    pub extensions: Option<HashMap<String, char>>,
+}
+
 #[rustfmt::skip]
 #[rustfmt::skip]
 #[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
 #[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
 pub struct UiStyles {
 pub struct UiStyles {
@@ -31,6 +39,8 @@ pub struct UiStyles {
     pub control_char:         Option<Style>,  // cc
     pub control_char:         Option<Style>,  // cc
     pub broken_symlink:       Option<Style>,  // or
     pub broken_symlink:       Option<Style>,  // or
     pub broken_path_overlay:  Option<Style>,  // bO
     pub broken_path_overlay:  Option<Style>,  // bO
+
+    pub icon_overrides: Option<IconOverrides>,
 }
 }
 // Macro to generate .unwrap_or_default getters for each field to cut down boilerplate
 // Macro to generate .unwrap_or_default getters for each field to cut down boilerplate
 macro_rules! field_accessors {
 macro_rules! field_accessors {
@@ -474,6 +484,8 @@ impl UiStyles {
             control_char: Some(Style::default()),
             control_char: Some(Style::default()),
             broken_symlink: Some(Style::default()),
             broken_symlink: Some(Style::default()),
             broken_path_overlay: Some(Style::default()),
             broken_path_overlay: Some(Style::default()),
+
+            icon_overrides: None,
         }
         }
     }
     }
 }
 }