term: improve iterm2 image pixel->cell calculation

If the image is smaller than the cell size we could end up
rounding that dimension to zero and ultimately not render
the texture to the cell.

This commit adjusts the math to round up, which yields
better results for the test in refs: https://github.com/wez/wezterm/issues/211
This commit is contained in:
Wez Furlong committed 2020-06-08 18:02:51 -07:00
1 parent 3fb3a61a99
commit fd512da983
1 file changed
+2 -2
+2 -2
View File
@@ -958,8 +958,8 @@ impl TerminalState {
(Some(w), Some(h)) => (w, h),
};
let width_in_cells = width / cell_pixel_width;
let height_in_cells = height / cell_pixel_height;
let width_in_cells = (width as f32 / cell_pixel_width as f32).ceil() as usize;
let height_in_cells = (height as f32 / cell_pixel_height as f32).ceil() as usize;
// TODO: defer this to the actual renderer
/*