1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 13:21:38 +03:00

Remove BlockOutline cursor style

Not really needed, since its something we can handle at rendering time.
This commit is contained in:
Jeremy Fitzhardinge 2019-12-29 13:40:07 -08:00 committed by Wez Furlong
parent 999ba79436
commit 887991f464
4 changed files with 7 additions and 26 deletions

View File

@ -2136,7 +2136,7 @@ impl TermWindow {
// Work out the blinking shape if its a blinking cursor and it hasn't been disabled
// and the window is focused.
let blinking = shape.is_blinking() && config.cursor_blink_rate != 0 && self.focused;
let shape = if blinking {
if blinking {
// Divide the time since we last moved by the blink rate.
// If the result is even then the cursor is "on", else it
// is "off"
@ -2152,29 +2152,23 @@ impl TermWindow {
}
} else {
shape
};
// Get the cursor shape if the window is defocused.
if self.focused {
shape
} else {
shape.defocused()
}
} else {
CursorShape::Hidden
};
let (fg_color, bg_color) = match (selected, cursor_shape) {
let (fg_color, bg_color) = match (selected, self.focused, cursor_shape) {
// Selected text overrides colors
(true, CursorShape::Hidden) => (
(true, _, CursorShape::Hidden) => (
rgbcolor_to_window_color(palette.selection_fg),
rgbcolor_to_window_color(palette.selection_bg),
),
// Cursor cell overrides colors
(_, CursorShape::BlinkingBlock) | (_, CursorShape::SteadyBlock) => (
(_, true, CursorShape::BlinkingBlock) | (_, true, CursorShape::SteadyBlock) => (
rgbcolor_to_window_color(palette.cursor_fg),
rgbcolor_to_window_color(palette.cursor_bg),
),
// Normally, render the cell as configured
// Normally, render the cell as configured (or if the window is unfocused)
_ => (fg_color, bg_color),
};

View File

@ -296,9 +296,7 @@ impl<T: Texture2d> UtilSprites<T> {
pub fn cursor_sprite(&self, shape: CursorShape) -> &Sprite<T> {
match shape {
CursorShape::Default | CursorShape::Hidden => &self.white_space,
CursorShape::BlockOutline | CursorShape::BlinkingBlock | CursorShape::SteadyBlock => {
&self.cursor_box
}
CursorShape::BlinkingBlock | CursorShape::SteadyBlock => &self.cursor_box,
CursorShape::BlinkingBar | CursorShape::SteadyBar => &self.cursor_i_beam,
CursorShape::BlinkingUnderline | CursorShape::SteadyUnderline => &self.cursor_underline,
}

View File

@ -531,7 +531,7 @@ impl TerminfoRenderer {
let param = match shape {
CursorShape::Default | CursorShape::Hidden => unreachable!(),
CursorShape::BlinkingBlock => 1,
CursorShape::SteadyBlock | CursorShape::BlockOutline => 2,
CursorShape::SteadyBlock => 2,
CursorShape::BlinkingUnderline => 3,
CursorShape::SteadyUnderline => 4,
CursorShape::BlinkingBar => 5,

View File

@ -33,7 +33,6 @@ pub enum Position {
pub enum CursorShape {
Hidden,
Default,
BlockOutline,
BlinkingBlock,
SteadyBlock,
BlinkingUnderline,
@ -55,16 +54,6 @@ impl CursorShape {
_ => false,
}
}
/// What shape cursor when we don't have focus
pub fn defocused(self) -> Self {
match self {
Self::BlinkingBlock | Self::SteadyBlock => Self::BlockOutline,
Self::BlinkingUnderline | Self::SteadyUnderline => Self::SteadyUnderline,
Self::BlinkingBar | Self::SteadyBar => Self::SteadyBar,
other => other,
}
}
}
/// SequenceNo indicates a logical position within a stream of changes.