Fix zero terminal sizes being treated as ok in Unix (#680)
This commit is contained in:
parent
ad0d100304
commit
f523c110a6
@ -40,11 +40,12 @@ pub(crate) fn size() -> Result<(u16, u16)> {
|
||||
};
|
||||
|
||||
if wrap_with_result(unsafe { ioctl(fd, TIOCGWINSZ.into(), &mut size) }).is_ok() {
|
||||
Ok((size.ws_col, size.ws_row))
|
||||
} else {
|
||||
tput_size().ok_or_else(|| std::io::Error::last_os_error().into())
|
||||
if 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())
|
||||
}
|
||||
|
||||
pub(crate) fn enable_raw_mode() -> Result<()> {
|
||||
let mut original_mode = TERMINAL_MODE_PRIOR_RAW_MODE.lock();
|
||||
|
Loading…
Reference in New Issue
Block a user