Finished IME for now

This commit is contained in:
Mikayla Maki 2022-08-18 12:57:19 -07:00
parent 6652d41864
commit d545e59b49
2 changed files with 13 additions and 11 deletions

View file

@ -1832,6 +1832,10 @@ impl Cursor {
block_text.paint(self.origin + origin, bounds, self.line_height, cx); block_text.paint(self.origin + origin, bounds, self.line_height, cx);
} }
} }
pub fn shape(&self) -> CursorShape {
self.shape
}
} }
#[derive(Debug)] #[derive(Debug)]

View file

@ -1,5 +1,5 @@
use alacritty_terminal::{ use alacritty_terminal::{
ansi::{Color as AnsiColor, Color::Named, NamedColor}, ansi::{Color as AnsiColor, Color::Named, CursorShape as AlacCursorShape, NamedColor},
grid::{Dimensions, Scroll}, grid::{Dimensions, Scroll},
index::{Column as GridCol, Line as GridLine, Point, Side}, index::{Column as GridCol, Line as GridLine, Point, Side},
selection::SelectionRange, selection::SelectionRange,
@ -647,7 +647,7 @@ impl Element for TerminalEl {
//Layout cursor. Rectangle is used for IME, so we should lay it out even //Layout cursor. Rectangle is used for IME, so we should lay it out even
//if we don't end up showing it. //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 None
} else { } else {
let cursor_point = DisplayCursor::from(cursor.point, display_offset); 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( TerminalEl::shape_cursor(cursor_point, dimensions, &cursor_text).map(
move |(cursor_position, block_width)| { move |(cursor_position, block_width)| {
let shape = match cursor.shape { let shape = match cursor.shape {
alacritty_terminal::ansi::CursorShape::Block if !self.focused => { AlacCursorShape::Block if !self.focused => CursorShape::Hollow,
CursorShape::Hollow AlacCursorShape::Block => CursorShape::Block,
} AlacCursorShape::Underline => CursorShape::Underscore,
alacritty_terminal::ansi::CursorShape::Block => CursorShape::Block, AlacCursorShape::Beam => CursorShape::Bar,
alacritty_terminal::ansi::CursorShape::Underline => CursorShape::Underscore, AlacCursorShape::HollowBlock => CursorShape::Hollow,
alacritty_terminal::ansi::CursorShape::Beam => CursorShape::Bar, //This case is handled in the if wrapping the whole cursor layout
alacritty_terminal::ansi::CursorShape::HollowBlock => CursorShape::Hollow, AlacCursorShape::Hidden => unreachable!(),
//This case is handled in the wrapping if
alacritty_terminal::ansi::CursorShape::Hidden => CursorShape::Block,
}; };
Cursor::new( Cursor::new(