aboutsummaryrefslogtreecommitdiff
path: root/src/term
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2017-12-03 21:38:42 +0000
committerJoe Wilm <jwilm@users.noreply.github.com>2017-12-03 13:38:42 -0800
commit9bdac6b50aa911cd8f94624a1084a1ba35be6ed4 (patch)
tree0809e0e65413978c8f906528bee192559a05fa78 /src/term
parentd552d28418ef192724b2b4353863708f31f325d4 (diff)
downloadalacritty-9bdac6b50aa911cd8f94624a1084a1ba35be6ed4.tar.gz
alacritty-9bdac6b50aa911cd8f94624a1084a1ba35be6ed4.zip
Add cursor style option (#928)
The default cursor can now be configured through the cursor_style field of the config. Valid options include Block, Underline, and Beam. The default can be restored by sending \e[0q as in VTE terminals. Live config reloading is supported for this parameter.
Diffstat (limited to 'src/term')
-rw-r--r--src/term/mod.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs
index 51620762..6bce8451 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -708,7 +708,11 @@ pub struct Term {
/// Original colors from config
original_colors: color::List,
- cursor_style: CursorStyle,
+ /// Current style of the cursor
+ cursor_style: Option<CursorStyle>,
+
+ /// Default style for resetting the cursor
+ default_cursor_style: CursorStyle,
}
/// Terminal size info
@@ -773,7 +777,7 @@ impl Term {
self.next_title.take()
}
- pub fn new(config : &Config, size: SizeInfo) -> Term {
+ pub fn new(config: &Config, size: SizeInfo) -> Term {
let template = Cell::default();
let num_cols = size.cols();
@@ -810,7 +814,8 @@ impl Term {
color_modified: [false; color::COUNT],
original_colors: color::List::from(config.colors()),
semantic_escape_chars: config.selection().semantic_escape_chars.clone(),
- cursor_style: CursorStyle::Block,
+ cursor_style: None,
+ default_cursor_style: config.cursor_style(),
}
}
@@ -835,6 +840,7 @@ impl Term {
}
}
self.visual_bell.update_config(config);
+ self.default_cursor_style = config.cursor_style();
}
#[inline]
@@ -1003,7 +1009,7 @@ impl Term {
self.mode,
config,
selection,
- self.cursor_style,
+ self.cursor_style.unwrap_or(self.default_cursor_style),
)
}
@@ -1869,7 +1875,7 @@ impl ansi::Handler for Term {
}
#[inline]
- fn set_cursor_style(&mut self, style: CursorStyle) {
+ fn set_cursor_style(&mut self, style: Option<CursorStyle>) {
trace!("set_cursor_style {:?}", style);
self.cursor_style = style;
}