diff --git a/src/frontend/gui/termwindow.rs b/src/frontend/gui/termwindow.rs index ef702b5e0..445b95bbc 100644 --- a/src/frontend/gui/termwindow.rs +++ b/src/frontend/gui/termwindow.rs @@ -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), }; diff --git a/src/frontend/gui/utilsprites.rs b/src/frontend/gui/utilsprites.rs index f0d8fc95e..f41ab3500 100644 --- a/src/frontend/gui/utilsprites.rs +++ b/src/frontend/gui/utilsprites.rs @@ -296,9 +296,7 @@ impl UtilSprites { pub fn cursor_sprite(&self, shape: CursorShape) -> &Sprite { 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, } diff --git a/termwiz/src/render/terminfo.rs b/termwiz/src/render/terminfo.rs index dd98f46a6..530ea5fb2 100644 --- a/termwiz/src/render/terminfo.rs +++ b/termwiz/src/render/terminfo.rs @@ -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, diff --git a/termwiz/src/surface/mod.rs b/termwiz/src/surface/mod.rs index 453fab213..380e81240 100644 --- a/termwiz/src/surface/mod.rs +++ b/termwiz/src/surface/mod.rs @@ -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.