From 188b775fa6a21ec3c91f6e524b1e0990f74b3b56 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Fri, 7 Oct 2022 10:03:09 -0700 Subject: [PATCH] Fixed non-block terminal cursors being displayed incorrectly --- crates/terminal/src/terminal_element.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/terminal/src/terminal_element.rs b/crates/terminal/src/terminal_element.rs index e7fd69fe49bdfff3ebaa462343f2283821cfaa8f..0f037863af38dd50317fd2bf09c315e11a1971e0 100644 --- a/crates/terminal/src/terminal_element.rs +++ b/crates/terminal/src/terminal_element.rs @@ -680,12 +680,12 @@ impl Element for TerminalElement { let focused = self.focused; TerminalElement::shape_cursor(cursor_point, dimensions, &cursor_text).map( move |(cursor_position, block_width)| { - let shape = match cursor.shape { - AlacCursorShape::Block if !focused => CursorShape::Hollow, - AlacCursorShape::Block => CursorShape::Block, - AlacCursorShape::Underline => CursorShape::Underscore, - AlacCursorShape::Beam => CursorShape::Bar, - AlacCursorShape::HollowBlock => CursorShape::Hollow, + let (shape, text) = match cursor.shape { + AlacCursorShape::Block if !focused => (CursorShape::Hollow, None), + AlacCursorShape::Block => (CursorShape::Block, Some(cursor_text)), + AlacCursorShape::Underline => (CursorShape::Underscore, None), + AlacCursorShape::Beam => (CursorShape::Bar, None), + AlacCursorShape::HollowBlock => (CursorShape::Hollow, None), //This case is handled in the if wrapping the whole cursor layout AlacCursorShape::Hidden => unreachable!(), }; @@ -696,7 +696,7 @@ impl Element for TerminalElement { dimensions.line_height, terminal_theme.colors.cursor, shape, - Some(cursor_text), + text, ) }, )