Skip to content
This repository was archived by the owner on Mar 10, 2021. It is now read-only.

Commit 1fc68d3

Browse files
authored
Merge pull request #7 from kbknapp/issue-6
Issue 6
2 parents fd70b99 + c52f989 commit 1fc68d3

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

.travis.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ sudo: false
22
language: rust
33
rust:
44
- nightly
5-
- nightly-2016-06-05
5+
- nightly-2016-09-04
66
- beta
77
- stable
8-
# Only while clippy is failing
98
matrix:
109
allow_failures:
1110
- rust: nightly
@@ -18,8 +17,7 @@ script:
1817
cargo build --verbose &&
1918
cargo test --verbose &&
2019
travis-cargo --only nightly build &&
21-
travis-cargo --only nightly bench &&
22-
travis-cargo --only stable doc
20+
travis-cargo --only nightly bench
2321
addons:
2422
apt:
2523
packages:
@@ -28,7 +26,6 @@ addons:
2826
- libdw-dev
2927
after_success:
3028
- |
31-
travis-cargo --only stable doc-upload &&
3229
travis-cargo --only stable coveralls --no-sudo
3330
env:
3431
global:

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
<a name="v0.2.1"></a>
2+
### v0.2.1 (2016-09-05)
3+
4+
5+
#### Bug Fixes
6+
7+
* 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))
8+
9+
10+
111

212
<a name="v0.2.0">v0.2.0</a>
313
## v0.2.0 (2016-09-05)

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "term_size"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
authors = ["Kevin K. <[email protected]>", "Benjamin Sago <[email protected]>"]
55
exclude = []
66
description = "functions for determining terminal sizes and dimensions"
@@ -11,7 +11,7 @@ license = "MIT/Apache-2.0"
1111
keywords = ["term", "terminal", "size", "width", "dimension"]
1212

1313
[dependencies]
14-
clippy = { version = "~0.0.74", optional = true }
14+
clippy = { version = "~0.0.88", optional = true }
1515

1616
[target.'cfg(not(target_os = "windows"))'.dependencies]
1717
libc = "~0.2.9"

src/lib.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,7 @@ use winapi::{CONSOLE_SCREEN_BUFFER_INFO, COORD, SMALL_RECT, STD_OUTPUT_HANDLE};
2727
#[cfg(not(target_os = "windows"))]
2828
use std::mem::zeroed;
2929
#[cfg(not(target_os = "windows"))]
30-
use libc::{STDOUT_FILENO, c_int, c_ulong, c_ushort};
31-
32-
/// The number of rows and columns of a terminal.
33-
#[cfg(not(target_os = "windows"))]
34-
#[repr(C)]
35-
struct Winsize {
36-
ws_row: c_ushort,
37-
ws_col: c_ushort,
38-
}
30+
use libc::{STDOUT_FILENO, c_int, c_ulong, winsize};
3931

4032
// Unfortunately the actual command is not standardised...
4133
#[cfg(any(target_os = "linux", target_os = "android"))]
@@ -62,8 +54,8 @@ extern "C" {
6254
/// there is an error. (0, 0) is an invalid size to have anyway, which is why
6355
/// it can be used as a nil value.
6456
#[cfg(not(target_os = "windows"))]
65-
unsafe fn get_dimensions() -> Winsize {
66-
let mut window: Winsize = zeroed();
57+
unsafe fn get_dimensions() -> winsize {
58+
let mut window: winsize = zeroed();
6759
let result = ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut window);
6860

6961
if result == -1 {

0 commit comments

Comments
 (0)