From 216986ecdbe528523953a1cde4cf6c329a0f4fbc Mon Sep 17 00:00:00 2001 From: Kevin K Date: Mon, 5 Sep 2016 15:39:22 -0400 Subject: [PATCH 1/3] fix: uses libc::winsize instead of homegrown Closes #6 --- src/lib.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5df8b12..ba89ce2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,15 +27,7 @@ use winapi::{CONSOLE_SCREEN_BUFFER_INFO, COORD, SMALL_RECT, STD_OUTPUT_HANDLE}; #[cfg(not(target_os = "windows"))] use std::mem::zeroed; #[cfg(not(target_os = "windows"))] -use libc::{STDOUT_FILENO, c_int, c_ulong, c_ushort}; - -/// The number of rows and columns of a terminal. -#[cfg(not(target_os = "windows"))] -#[repr(C)] -struct Winsize { - ws_row: c_ushort, - ws_col: c_ushort, -} +use libc::{STDOUT_FILENO, c_int, c_ulong, winsize}; // Unfortunately the actual command is not standardised... #[cfg(any(target_os = "linux", target_os = "android"))] @@ -62,8 +54,8 @@ extern "C" { /// there is an error. (0, 0) is an invalid size to have anyway, which is why /// it can be used as a nil value. #[cfg(not(target_os = "windows"))] -unsafe fn get_dimensions() -> Winsize { - let mut window: Winsize = zeroed(); +unsafe fn get_dimensions() -> winsize { + let mut window: winsize = zeroed(); let result = ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut window); if result == -1 { From 34fe8f479ce8ba64045851f7d0e541d7b269d182 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Mon, 5 Sep 2016 15:40:07 -0400 Subject: [PATCH 2/3] chore: increase version --- CHANGELOG.md | 10 ++++++++++ Cargo.toml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2ecbfa..4b00f0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +### v0.2.1 (2016-09-05) + + +#### Bug Fixes + +* uses libc::winsize instead of homegrown ([216986ec](https://github.com/kbknapp/term_size-rs/commit/216986ecdbe528523953a1cde4cf6c329a0f4fbc), closes [#6](https://github.com/kbknapp/term_size-rs/issues/6)) + + + v0.2.0 ## v0.2.0 (2016-09-05) diff --git a/Cargo.toml b/Cargo.toml index e0a8830..4ed62f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "term_size" -version = "0.2.0" +version = "0.2.1" authors = ["Kevin K. ", "Benjamin Sago "] exclude = [] description = "functions for determining terminal sizes and dimensions" From c52f989fe8e76e4f7ac3b4466cb9f8acb88a3913 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Mon, 5 Sep 2016 15:43:28 -0400 Subject: [PATCH 3/3] chore: updates travis config --- .travis.yml | 7 ++----- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9c38f26..c795a23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,9 @@ sudo: false language: rust rust: - nightly - - nightly-2016-06-05 + - nightly-2016-09-04 - beta - stable -# Only while clippy is failing matrix: allow_failures: - rust: nightly @@ -18,8 +17,7 @@ script: cargo build --verbose && cargo test --verbose && travis-cargo --only nightly build && - travis-cargo --only nightly bench && - travis-cargo --only stable doc + travis-cargo --only nightly bench addons: apt: packages: @@ -28,7 +26,6 @@ addons: - libdw-dev after_success: - | - travis-cargo --only stable doc-upload && travis-cargo --only stable coveralls --no-sudo env: global: diff --git a/Cargo.toml b/Cargo.toml index 4ed62f5..9bad884 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT/Apache-2.0" keywords = ["term", "terminal", "size", "width", "dimension"] [dependencies] -clippy = { version = "~0.0.74", optional = true } +clippy = { version = "~0.0.88", optional = true } [target.'cfg(not(target_os = "windows"))'.dependencies] libc = "~0.2.9"