summaryrefslogtreecommitdiffstats
path: root/zellij-client
diff options
context:
space:
mode:
authorThomas Linford <tlinford@users.noreply.github.com>2022-07-04 18:28:37 +0200
committerGitHub <noreply@github.com>2022-07-04 18:28:37 +0200
commit3aef436a694935fcb5333f642e7b24ab8f57579e (patch)
treee35c07646993e965443ef0dbd8d7d9aabc902c85 /zellij-client
parentc5e82b724778832e0d57adaa3abc058c588f3996 (diff)
fix: fallback to default values when terminal rows/cols are 0 (#1552)
* fix: fallback to default values when terminal rows/cols = 0 * increase retry_pause for failing test * e2e: load fixtures with cat * use variable for fixture path
Diffstat (limited to 'zellij-client')
-rw-r--r--zellij-client/src/os_input_output.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/zellij-client/src/os_input_output.rs b/zellij-client/src/os_input_output.rs
index 2be1a90af..a344f940d 100644
--- a/zellij-client/src/os_input_output.rs
+++ b/zellij-client/src/os_input_output.rs
@@ -55,10 +55,21 @@ pub(crate) fn get_terminal_size_using_fd(fd: RawFd) -> Size {
unsafe {
ioctl(fd, TIOCGWINSZ.into(), &mut winsize)
};
- Size {
- rows: winsize.ws_row as usize,
- cols: winsize.ws_col as usize,
- }
+
+ // fallback to default values when rows/cols == 0: https://github.com/zellij-org/zellij/issues/1551
+ let rows = if winsize.ws_row != 0 {
+ winsize.ws_row as usize
+ } else {
+ 24
+ };
+
+ let cols = if winsize.ws_col != 0 {
+ winsize.ws_col as usize
+ } else {
+ 80
+ };
+
+ Size { rows, cols }
}
#[derive(Clone)]