pub struct Winsize {
pub row: u16,
pub col: u16,
pub xpixel: u16,
pub ypixel: u16,
}Expand description
Terminal dimensions in cells and pixels.
row and col are the cell dimensions used for terminal layout. xpixel
and ypixel are optional pixel dimensions; they are 0 when the platform
or terminal does not report pixel size.
Fields§
§row: u16Number of rows (height in cells).
col: u16Number of columns (width in cells).
xpixel: u16Width in pixels, or 0 when unknown.
ypixel: u16Height in pixels, or 0 when unknown.
Implementations§
Source§impl Winsize
impl Winsize
Sourcepub fn estimated_cell_pixel_size(self) -> Option<Size>
pub fn estimated_cell_pixel_size(self) -> Option<Size>
Estimate one cell’s pixel size from the terminal’s window dimensions.
This divides the pixel width and height by the number of columns and
rows. It returns None when a dimension is zero or unknown. The
result is rounded down and may be smaller than the actual cell size
when the window has padding.
Use crate::program::Program::request_cell_pixel_size when you need
the size reported directly by the terminal.