diff options
Diffstat (limited to 'alacritty_terminal/src/config')
-rw-r--r-- | alacritty_terminal/src/config/colors.rs | 2 | ||||
-rw-r--r-- | alacritty_terminal/src/config/mod.rs | 32 |
2 files changed, 22 insertions, 12 deletions
diff --git a/alacritty_terminal/src/config/colors.rs b/alacritty_terminal/src/config/colors.rs index 35c03684..5c057619 100644 --- a/alacritty_terminal/src/config/colors.rs +++ b/alacritty_terminal/src/config/colors.rs @@ -12,6 +12,8 @@ pub struct Colors { #[serde(deserialize_with = "failure_default")] pub cursor: CursorColors, #[serde(deserialize_with = "failure_default")] + pub vi_mode_cursor: CursorColors, + #[serde(deserialize_with = "failure_default")] pub selection: SelectionColors, #[serde(deserialize_with = "failure_default")] normal: NormalColors, diff --git a/alacritty_terminal/src/config/mod.rs b/alacritty_terminal/src/config/mod.rs index da95391c..df8d37bd 100644 --- a/alacritty_terminal/src/config/mod.rs +++ b/alacritty_terminal/src/config/mod.rs @@ -28,7 +28,7 @@ mod scrolling; mod visual_bell; mod window; -use crate::ansi::{Color, CursorStyle, NamedColor}; +use crate::ansi::{CursorStyle, NamedColor}; pub use crate::config::colors::Colors; pub use crate::config::debug::Debug; @@ -170,16 +170,28 @@ impl<T> Config<T> { self.dynamic_title.0 } - /// Cursor foreground color + /// Cursor foreground color. #[inline] pub fn cursor_text_color(&self) -> Option<Rgb> { self.colors.cursor.text } - /// Cursor background color + /// Cursor background color. #[inline] - pub fn cursor_cursor_color(&self) -> Option<Color> { - self.colors.cursor.cursor.map(|_| Color::Named(NamedColor::Cursor)) + pub fn cursor_cursor_color(&self) -> Option<NamedColor> { + self.colors.cursor.cursor.map(|_| NamedColor::Cursor) + } + + /// Vi mode cursor foreground color. + #[inline] + pub fn vi_mode_cursor_text_color(&self) -> Option<Rgb> { + self.colors.vi_mode_cursor.text + } + + /// Vi mode cursor background color. + #[inline] + pub fn vi_mode_cursor_cursor_color(&self) -> Option<Rgb> { + self.colors.vi_mode_cursor.cursor } #[inline] @@ -230,20 +242,16 @@ impl Default for EscapeChars { } #[serde(default)] -#[derive(Copy, Clone, Debug, Deserialize, PartialEq, Eq)] +#[derive(Deserialize, Copy, Clone, Debug, Default, PartialEq, Eq)] pub struct Cursor { #[serde(deserialize_with = "failure_default")] pub style: CursorStyle, + #[serde(deserialize_with = "option_explicit_none")] + pub vi_mode_style: Option<CursorStyle>, #[serde(deserialize_with = "failure_default")] unfocused_hollow: DefaultTrueBool, } -impl Default for Cursor { - fn default() -> Self { - Self { style: Default::default(), unfocused_hollow: Default::default() } - } -} - impl Cursor { pub fn unfocused_hollow(self) -> bool { self.unfocused_hollow.0 |