mirror of
				https://github.com/crossterm-rs/crossterm.git
				synced 2025-11-04 07:24:40 +00:00 
			
		
		
		
	Fix zero terminal sizes being treated as ok in Unix (#680)
This commit is contained in:
		
							parent
							
								
									ad0d100304
								
							
						
					
					
						commit
						f523c110a6
					
				@ -40,10 +40,11 @@ pub(crate) fn size() -> Result<(u16, u16)> {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if wrap_with_result(unsafe { ioctl(fd, TIOCGWINSZ.into(), &mut size) }).is_ok() {
 | 
					    if wrap_with_result(unsafe { ioctl(fd, TIOCGWINSZ.into(), &mut size) }).is_ok() {
 | 
				
			||||||
        Ok((size.ws_col, size.ws_row))
 | 
					        if size.ws_col != 0 && size.ws_row != 0 {
 | 
				
			||||||
    } else {
 | 
					            return Ok((size.ws_col, size.ws_row));
 | 
				
			||||||
        tput_size().ok_or_else(|| std::io::Error::last_os_error().into())
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    tput_size().ok_or_else(|| std::io::Error::last_os_error().into())
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub(crate) fn enable_raw_mode() -> Result<()> {
 | 
					pub(crate) fn enable_raw_mode() -> Result<()> {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user