diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index a68847904746f2afdca4b9143f7285d42228eea6..c935df7d07a47479b032cc16aad0d585c04a3c2a 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1832,6 +1832,10 @@ impl Cursor { block_text.paint(self.origin + origin, bounds, self.line_height, cx); } } + + pub fn shape(&self) -> CursorShape { + self.shape + } } #[derive(Debug)] diff --git a/crates/terminal/src/connected_el.rs b/crates/terminal/src/connected_el.rs index 230c8025031bd92b6028ecf58347c72ec55e3f3e..f21727af66eb69dcc2ed67c12054787f7660bdbb 100644 --- a/crates/terminal/src/connected_el.rs +++ b/crates/terminal/src/connected_el.rs @@ -1,5 +1,5 @@ use alacritty_terminal::{ - ansi::{Color as AnsiColor, Color::Named, NamedColor}, + ansi::{Color as AnsiColor, Color::Named, CursorShape as AlacCursorShape, NamedColor}, grid::{Dimensions, Scroll}, index::{Column as GridCol, Line as GridLine, Point, Side}, selection::SelectionRange, @@ -647,7 +647,7 @@ impl Element for TerminalEl { //Layout cursor. Rectangle is used for IME, so we should lay it out even //if we don't end up showing it. - let cursor = if let alacritty_terminal::ansi::CursorShape::Hidden = cursor.shape { + let cursor = if let AlacCursorShape::Hidden = cursor.shape { None } else { let cursor_point = DisplayCursor::from(cursor.point, display_offset); @@ -677,15 +677,13 @@ impl Element for TerminalEl { TerminalEl::shape_cursor(cursor_point, dimensions, &cursor_text).map( move |(cursor_position, block_width)| { let shape = match cursor.shape { - alacritty_terminal::ansi::CursorShape::Block if !self.focused => { - CursorShape::Hollow - } - alacritty_terminal::ansi::CursorShape::Block => CursorShape::Block, - alacritty_terminal::ansi::CursorShape::Underline => CursorShape::Underscore, - alacritty_terminal::ansi::CursorShape::Beam => CursorShape::Bar, - alacritty_terminal::ansi::CursorShape::HollowBlock => CursorShape::Hollow, - //This case is handled in the wrapping if - alacritty_terminal::ansi::CursorShape::Hidden => CursorShape::Block, + AlacCursorShape::Block if !self.focused => CursorShape::Hollow, + AlacCursorShape::Block => CursorShape::Block, + AlacCursorShape::Underline => CursorShape::Underscore, + AlacCursorShape::Beam => CursorShape::Bar, + AlacCursorShape::HollowBlock => CursorShape::Hollow, + //This case is handled in the if wrapping the whole cursor layout + AlacCursorShape::Hidden => unreachable!(), }; Cursor::new(