- commit
- cdb920b61cfaad64214278c667db223db0ba4634
- parent
- 44efc66f02b3d201aef7532cd05cb0dd2e37e583
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2025-02-23 09:34
get_terminal_size: mark value as mutable fixes case where the result mysteriously turns into 0 as soon as it is used (probably because the compiler switched the order around).
Diffstat
| M | src/term.rs | 4 | ++-- |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/term.rs b/src/term.rs
@@ -1,10 +1,10 @@ 1 1 extern crate libc; 2 2 3 3 fn get_terminal_size() -> (usize, usize) {4 -1 let w: libc::winsize;-1 4 let mut w: libc::winsize; 5 5 unsafe { 6 6 w = std::mem::zeroed();7 -1 libc::ioctl(1, libc::TIOCGWINSZ, &w);-1 7 libc::ioctl(1, libc::TIOCGWINSZ, &mut w); 8 8 } 9 9 return (w.ws_col as usize, w.ws_row as usize); 10 10 }