Terminal size to 1-based (#170) (#176)

This commit is contained in:
Nathaniel Braun 2019-07-09 19:54:45 +03:00 committed by Timon
parent 44d180cb46
commit d689d7e8ed
2 changed files with 2 additions and 3 deletions

View File

@ -9,7 +9,7 @@ pub fn exit() {
pub fn get_terminal_size() -> (u16, u16) { pub fn get_terminal_size() -> (u16, u16) {
if let Ok(buffer) = ScreenBuffer::current() { if let Ok(buffer) = ScreenBuffer::current() {
let size = buffer.info().unwrap().terminal_size(); let size = buffer.info().unwrap().terminal_size();
(size.width as u16, size.height as u16) (size.width + 1, size.height + 1).into()
} else { } else {
(0, 0) (0, 0)
} }

View File

@ -39,8 +39,7 @@ impl ITerminal for WinApiTerminal {
} }
fn terminal_size(&self) -> (u16, u16) { fn terminal_size(&self) -> (u16, u16) {
let csbi = ScreenBuffer::current().unwrap(); get_terminal_size()
csbi.info().unwrap().terminal_size().into()
} }
fn scroll_up(&self, count: i16) -> Result<()> { fn scroll_up(&self, count: i16) -> Result<()> {