mirror of
https://github.com/crossterm-rs/crossterm.git
synced 2025-05-05 15:32:57 +00:00
d
This commit is contained in:
parent
59844ef8c7
commit
caea65628c
@ -39,11 +39,13 @@ pub(crate) fn size() -> Result<(u16, u16)> {
|
||||
STDOUT_FILENO
|
||||
};
|
||||
|
||||
if wrap_with_result(unsafe { ioctl(fd, TIOCGWINSZ.into(), &mut size) }).is_ok() {
|
||||
if size.ws_col != 0 && size.ws_row != 0 {
|
||||
return Ok((size.ws_col, size.ws_row));
|
||||
}
|
||||
if wrap_with_result(unsafe { ioctl(fd, TIOCGWINSZ.into(), &mut size) }).is_ok()
|
||||
&& size.ws_col != 0
|
||||
&& size.ws_row != 0
|
||||
{
|
||||
return Ok((size.ws_col, size.ws_row));
|
||||
}
|
||||
|
||||
tput_size().ok_or_else(|| std::io::Error::last_os_error().into())
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user