From 61db60b3e21a9a562d22afc222bdb152b9767286 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 4 Jan 2024 14:55:45 -0800 Subject: [PATCH] Fix incorrect placement of terminal selection when dragging Co-authored-by: Mikayla --- crates/terminal/src/mappings/mouse.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/terminal/src/mappings/mouse.rs b/crates/terminal/src/mappings/mouse.rs index a32d83d28d..19c699216a 100644 --- a/crates/terminal/src/mappings/mouse.rs +++ b/crates/terminal/src/mappings/mouse.rs @@ -162,22 +162,20 @@ pub fn mouse_side( pos: Point, cur_size: TerminalSize, ) -> alacritty_terminal::index::Direction { - let cell_width = cur_size.cell_width.floor(); + let cell_width = cur_size.cell_width; if cell_width == px(0.) { return Side::Right; } - let x = pos.x.floor(); - - let cell_x = cmp::max(px(0.), x - cell_width) % cell_width; - let half_cell_width = (cur_size.cell_width / 2.0).floor(); + let cell_x = cmp::max(px(0.), pos.x) % cell_width; + let half_cell_width = cur_size.cell_width / 2.0; let additional_padding = (cur_size.width() - cur_size.cell_width * 2.) % cur_size.cell_width; let end_of_grid = cur_size.width() - cur_size.cell_width - additional_padding; //Width: Pixels or columns? if cell_x > half_cell_width // Edge case when mouse leaves the window. - || x >= end_of_grid + || pos.x >= end_of_grid { Side::Right } else {