diff --git a/src/common_term.rs b/src/common_term.rs index 5b9deb3b..cc768d51 100644 --- a/src/common_term.rs +++ b/src/common_term.rs @@ -2,11 +2,6 @@ use std::io; use crate::term::Term; -#[inline] -pub fn terminal_size() -> Option<(u16, u16)> { - terminal_size::terminal_size().map(|x| ((x.0).0, (x.1).0)) -} - pub fn move_cursor_down(out: &Term, n: usize) -> io::Result<()> { if n > 0 { out.write_str(&format!("\x1b[{}B", n)) diff --git a/src/unix_term.rs b/src/unix_term.rs index b356b71a..e7e1ef5f 100644 --- a/src/unix_term.rs +++ b/src/unix_term.rs @@ -17,6 +17,11 @@ pub fn is_a_terminal(out: &Term) -> bool { unsafe { libc::isatty(out.as_raw_fd()) != 0 } } +#[inline] +pub fn terminal_size() -> Option<(u16, u16)> { + terminal_size::terminal_size().map(|x| ((x.0).0, (x.1).0)) +} + pub fn read_secure() -> io::Result { let f_tty; let fd = unsafe { diff --git a/src/windows_term.rs b/src/windows_term.rs index 06fa4700..4dceddf7 100644 --- a/src/windows_term.rs +++ b/src/windows_term.rs @@ -76,7 +76,7 @@ unsafe fn console_on_any(fds: &[DWORD]) -> bool { #[inline] pub fn terminal_size() -> Option<(u16, u16)> { - common_term::terminal_size() + terminal_size::terminal_size().map(|x| ((x.0).0, (x.1).0)) } pub fn move_cursor_to(out: &Term, x: usize, y: usize) -> io::Result<()> {