From 768ee43d5aef10790e3a276ece280fe019d78afc Mon Sep 17 00:00:00 2001 From: KENZ Date: Thu, 26 Feb 2026 01:05:30 +0900 Subject: [PATCH] Specify the line height to the IME cursor height --- src/terminal_box.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/terminal_box.rs b/src/terminal_box.rs index 26dee49..2de9e68 100644 --- a/src/terminal_box.rs +++ b/src/terminal_box.rs @@ -252,22 +252,24 @@ where let mut col = cursor.point.column.0; let line = cursor.point.line.0; let width = terminal.size().cell_width; - let mut bottom_left = Vector::::ZERO; + let mut cursor_position = Vector::::ZERO; + let mut line_height = 0.0; terminal.with_buffer(|buffer| { let layout = buffer.layout_runs().nth(line as usize).unwrap(); for glyph in layout.glyphs { - bottom_left.x += glyph.w; + cursor_position.x += glyph.w; let ch_width = if glyph.w > width { 2 } else { 1 }; if ch_width > col { break; } col -= ch_width; } - bottom_left.y = layout.line_top + layout.line_height; + cursor_position.y = layout.line_top; + line_height = layout.line_height; }); InputMethod::Enabled { - cursor: Rectangle::new(view_position + bottom_left, Size::default()), + cursor: Rectangle::new(view_position + cursor_position, Size::new(1.0, line_height)), purpose: input_method::Purpose::Normal, preedit: state.preedit.as_ref().map(input_method::Preedit::as_ref), }