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.
This commit is contained in:
parent
44251d9dbb
commit
6eb634a2b8
|
@ -255,7 +255,7 @@ pub fn get_beam_cursor_glyph(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a custom beam cursor character
|
// Returns a custom box cursor character
|
||||||
pub fn get_box_cursor_glyph(
|
pub fn get_box_cursor_glyph(
|
||||||
ascent: i32,
|
ascent: i32,
|
||||||
height: i32,
|
height: i32,
|
||||||
|
|
|
@ -136,12 +136,7 @@ impl<'a> RenderableCellsIter<'a> {
|
||||||
}.initialize(cursor_style, window_focused)
|
}.initialize(cursor_style, window_focused)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn populate_block_cursor(&mut self, window_focused: bool) {
|
fn populate_block_cursor(&mut self) {
|
||||||
if !window_focused {
|
|
||||||
self.populate_cursor(font::BOX_CURSOR_CHAR, ' ');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let (text_color, cursor_color) = if self.config.custom_cursor_colors() {
|
let (text_color, cursor_color) = if self.config.custom_cursor_colors() {
|
||||||
(
|
(
|
||||||
Color::Named(NamedColor::CursorText),
|
Color::Named(NamedColor::CursorText),
|
||||||
|
@ -233,15 +228,20 @@ impl<'a> RenderableCellsIter<'a> {
|
||||||
|
|
||||||
fn initialize(mut self, cursor_style: CursorStyle, window_focused: bool) -> Self {
|
fn initialize(mut self, cursor_style: CursorStyle, window_focused: bool) -> Self {
|
||||||
if self.cursor_is_visible() {
|
if self.cursor_is_visible() {
|
||||||
match cursor_style {
|
if !window_focused {
|
||||||
CursorStyle::Block => {
|
// Render the box cursor if the window is not focused
|
||||||
self.populate_block_cursor(window_focused);
|
self.populate_cursor(font::BOX_CURSOR_CHAR, ' ');
|
||||||
},
|
} else {
|
||||||
CursorStyle::Beam => {
|
match cursor_style {
|
||||||
self.populate_beam_cursor();
|
CursorStyle::Block => {
|
||||||
},
|
self.populate_block_cursor();
|
||||||
CursorStyle::Underline => {
|
},
|
||||||
self.populate_underline_cursor();
|
CursorStyle::Beam => {
|
||||||
|
self.populate_beam_cursor();
|
||||||
|
},
|
||||||
|
CursorStyle::Underline => {
|
||||||
|
self.populate_underline_cursor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue