diff options
author | Kirill Chibisov <wchibisovkirill@gmail.com> | 2019-07-11 00:24:04 +0300 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-07-10 21:24:04 +0000 |
commit | 9a159a77604e0354f1176b02ff700bc11da19c86 (patch) | |
tree | f430d60b8431e7862479a0579918e737289a2f38 /alacritty_terminal/src/config | |
parent | c4d2725e14ca9488b1b086024bf827c66945ae7b (diff) | |
download | alacritty-9a159a77604e0354f1176b02ff700bc11da19c86.tar.gz alacritty-9a159a77604e0354f1176b02ff700bc11da19c86.zip |
Fix cursor color setting with escape sequence
The cursor rework introduced a regression where cursor color was always picked
from a config file, rather then using `ansi::NamedColor::Cursor` for this
purpose.
This commit also removes `CursorText` option from `NamedColor` enum,
since we can't speculate with `CursorText` during runtime.
Cursor rework commits:
cfc20d4f34dca535654cc32df18e785296af4cc5
371d13f8ef95157c97f7de9964bcbc89d4a8e930
0d060d5d801e3abb55035269138d819d38fc175b
Diffstat (limited to 'alacritty_terminal/src/config')
-rw-r--r-- | alacritty_terminal/src/config/mod.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/alacritty_terminal/src/config/mod.rs b/alacritty_terminal/src/config/mod.rs index 63f0aace..e7155e0c 100644 --- a/alacritty_terminal/src/config/mod.rs +++ b/alacritty_terminal/src/config/mod.rs @@ -32,7 +32,7 @@ mod test; mod visual_bell; mod window; -use crate::ansi::CursorStyle; +use crate::ansi::{Color, CursorStyle, NamedColor}; use crate::input::{Binding, KeyBinding, MouseBinding}; pub use crate::config::bindings::Key; @@ -44,6 +44,7 @@ pub use crate::config::mouse::{ClickHandler, Mouse}; pub use crate::config::scrolling::Scrolling; pub use crate::config::visual_bell::{VisualBellAnimation, VisualBellConfig}; pub use crate::config::window::{Decorations, Dimensions, StartupMode, WindowConfig}; +use crate::term::color::Rgb; pub static DEFAULT_ALACRITTY_CONFIG: &str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../alacritty.yml")); @@ -190,6 +191,18 @@ impl Config { self.dynamic_title.0 } + /// Cursor foreground color + #[inline] + pub fn cursor_text_color(&self) -> Option<Rgb> { + self.colors.cursor.text + } + + /// Cursor background color + #[inline] + pub fn cursor_cursor_color(&self) -> Option<Color> { + self.colors.cursor.cursor.map(|_| Color::Named(NamedColor::Cursor)) + } + #[inline] pub fn set_dynamic_title(&mut self, dynamic_title: bool) { self.dynamic_title.0 = dynamic_title; |