From edfc4bbb05edb70279c720d28a1ba3cb580cbf7a Mon Sep 17 00:00:00 2001 From: Aron Parker Date: Mon, 2 Jan 2023 23:09:07 +0100 Subject: [PATCH] Fix invalid terminal size being returned on Windows (#151) --- src/windows_term/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/windows_term/mod.rs b/src/windows_term/mod.rs index ec2613b1..c4ec193c 100644 --- a/src/windows_term/mod.rs +++ b/src/windows_term/mod.rs @@ -137,9 +137,10 @@ pub fn terminal_size(out: &Term) -> Option<(u16, u16)> { return None; } - let w = (csbi.srWindow.Right - csbi.srWindow.Left + 1) as u16; - let h = (csbi.srWindow.Bottom - csbi.srWindow.Top + 1) as u16; - Some((w, h)) + let rows = (csbi.srWindow.Bottom - csbi.srWindow.Top + 1) as u16; + let columns = (csbi.srWindow.Right - csbi.srWindow.Left + 1) as u16; + + Some((rows, columns)) } pub fn move_cursor_to(out: &Term, x: usize, y: usize) -> io::Result<()> {