Skip to content

Commit

Permalink
Terminal size to 1-based (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
twe4ked authored and TimonPost committed Jul 6, 2019
1 parent ae5a210 commit 44d180c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions crossterm_terminal/src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ pub fn get_terminal_size() -> (u16, u16) {
let r = unsafe { ioctl(STDOUT_FILENO, TIOCGWINSZ.into(), &mut size) };

if r == 0 {
// because crossterm works starts counting at 0
// and unix terminal starts at cell 1
// you have subtract one to get 0-based results.
(size.ws_col - 1, size.ws_row - 1)
(size.ws_co, size.ws_row)
} else {
(0, 0)
}
Expand Down

0 comments on commit 44d180c

Please sign in to comment.