Skip to content

Commit ec4319f

Browse files
committed
fix ime positioning
1 parent 84290df commit ec4319f

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

  • frontends/rioterm/src/screen

frontends/rioterm/src/screen/mod.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3291,17 +3291,20 @@ impl Screen<'_> {
32913291
return;
32923292
}
32933293

3294-
let current_context = self.context_manager.current();
3295-
let terminal = current_context.terminal.lock();
3294+
let current_grid = self.context_manager.current_grid();
3295+
let (context, margin) = current_grid.current_context_with_computed_dimension();
3296+
let layout = context.dimension;
3297+
let terminal = context.terminal.lock();
32963298
let cursor_pos = terminal.grid.cursor.pos;
3297-
let layout = current_context.dimension;
32983299
drop(terminal);
32993300

33003301
// Calculate pixel position of cursor
33013302
let cell_width = layout.dimension.width;
3302-
let cell_height = layout.dimension.height;
3303-
let margin_x = layout.margin.left * layout.dimension.scale;
3304-
let margin_y = layout.margin.top * layout.dimension.scale;
3303+
let line_height = self.sugarloaf.style().line_height;
3304+
let cell_height = layout.dimension.height * line_height;
3305+
// Margin from current_context_with_computed_dimension is already pre-scaled
3306+
let margin_x = margin.left;
3307+
let margin_y = margin.top;
33053308

33063309
// Validate dimensions before calculation
33073310
if cell_width <= 0.0 || cell_height <= 0.0 {
@@ -3316,8 +3319,7 @@ impl Screen<'_> {
33163319
// Convert grid position to pixel position, centering horizontally in the cell
33173320
let pixel_x =
33183321
margin_x + (cursor_pos.col.0 as f32 * cell_width) + (cell_width * 0.5);
3319-
let pixel_y =
3320-
margin_y + (cursor_pos.row.0 as f32 * cell_height * layout.line_height);
3322+
let pixel_y = margin_y + (cursor_pos.row.0 as f32 * cell_height);
33213323

33223324
// Validate final coordinates
33233325
if pixel_x.is_nan() || pixel_y.is_nan() || pixel_x < 0.0 || pixel_y < 0.0 {

0 commit comments

Comments
 (0)