diff options
author | Christian Duerr <contact@christianduerr.com> | 2017-12-13 18:24:12 +0100 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-12-24 09:46:54 -0800 |
commit | 6eb634a2b83a8a401973ec9e52c7c7ffb5b9fe84 (patch) | |
tree | fbd7755e3fa77d444efade621054069071db6b53 /src/term | |
parent | 44251d9dbb411b5e915d28a8c10c3b34cb42abfd (diff) | |
download | alacritty-6eb634a2b83a8a401973ec9e52c7c7ffb5b9fe84.tar.gz alacritty-6eb634a2b83a8a401973ec9e52c7c7ffb5b9fe84.zip |
Add box cursor to unfocused underline and beam
Because some people have requested this change, the beam and underline
cursors now also transform into an empty box when the terminal loses
focus. Like this there is one unique symbol to indicate that a terminal
is not currently focused.
Diffstat (limited to 'src/term')
-rw-r--r-- | src/term/mod.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index da59a037..571686c1 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -136,12 +136,7 @@ impl<'a> RenderableCellsIter<'a> { }.initialize(cursor_style, window_focused) } - fn populate_block_cursor(&mut self, window_focused: bool) { - if !window_focused { - self.populate_cursor(font::BOX_CURSOR_CHAR, ' '); - return; - } - + fn populate_block_cursor(&mut self) { let (text_color, cursor_color) = if self.config.custom_cursor_colors() { ( Color::Named(NamedColor::CursorText), @@ -233,15 +228,20 @@ impl<'a> RenderableCellsIter<'a> { fn initialize(mut self, cursor_style: CursorStyle, window_focused: bool) -> Self { if self.cursor_is_visible() { - match cursor_style { - CursorStyle::Block => { - self.populate_block_cursor(window_focused); - }, - CursorStyle::Beam => { - self.populate_beam_cursor(); - }, - CursorStyle::Underline => { - self.populate_underline_cursor(); + if !window_focused { + // Render the box cursor if the window is not focused + self.populate_cursor(font::BOX_CURSOR_CHAR, ' '); + } else { + match cursor_style { + CursorStyle::Block => { + self.populate_block_cursor(); + }, + CursorStyle::Beam => { + self.populate_beam_cursor(); + }, + CursorStyle::Underline => { + self.populate_underline_cursor(); + } } } } else { |