Fix a porting bugs for terminal2

co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
Mikayla 2023-12-06 15:07:09 -08:00
parent 735f2029e9
commit 12e7f61f62
No known key found for this signature in database
6 changed files with 36 additions and 67 deletions

View file

@ -186,9 +186,9 @@ pub fn mouse_side(
}
pub fn grid_point(pos: Point<Pixels>, cur_size: TerminalSize, display_offset: usize) -> AlacPoint {
let col = GridCol((cur_size.cell_width / pos.x) as usize);
let col = GridCol((pos.x / cur_size.cell_width) as usize);
let col = min(col, cur_size.last_column());
let line = (cur_size.line_height / pos.y) as i32;
let line = (pos.y / cur_size.line_height) as i32;
let line = min(line, cur_size.bottommost_line().0);
AlacPoint::new(GridLine(line - display_offset as i32), col)
}