winsize 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -3
- data/ext/extconf.rb +4 -2
- data/ext/winsize.c +3 -3
- data/lib/winsize.rb +4 -0
- data/lib/winsize/version.rb +1 -1
- metadata +25 -30
data/README.md
CHANGED
@@ -49,11 +49,11 @@ size = Winsize.new(32, 160)
|
|
49
49
|
# or
|
50
50
|
# size = $stdout.winsize
|
51
51
|
|
52
|
-
|
52
|
+
input, output, pid = PTY.spawn
|
53
53
|
|
54
|
-
|
54
|
+
output.winsize = size
|
55
55
|
# or
|
56
|
-
#
|
56
|
+
# output.winsize = 32, 160
|
57
57
|
```
|
58
58
|
|
59
59
|
You may want to combine `winsize` and catching the [`SIGWINCH`](http://en.wikipedia.org/wiki/SIGWINCH) signal so you
|
@@ -67,4 +67,6 @@ puts "Terminal size is #{$stdout.winsize.columns}x#{$stdout.winsize.rows}"
|
|
67
67
|
Signal.trap "WINCH" do
|
68
68
|
puts "Terminal resized to #{$stdout.winsize.columns}x#{$stdout.winsize.rows}"
|
69
69
|
end
|
70
|
+
|
71
|
+
loop { sleep(10) }
|
70
72
|
```
|
data/ext/extconf.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require "mkmf"
|
2
2
|
|
3
|
-
abort
|
3
|
+
abort "sys/ioctl.h is required" unless have_header("sys/ioctl.h")
|
4
|
+
abort "TIOCGWINSZ is required" unless have_const("TIOCGWINSZ", "sys/ioctl.h")
|
5
|
+
abort "TIOCSWINSZ is required" unless have_const("TIOCSWINSZ", "sys/ioctl.h")
|
4
6
|
|
5
|
-
create_makefile
|
7
|
+
create_makefile "winsize"
|
data/ext/winsize.c
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
void Init_winsize()
|
5
5
|
{
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
VALUE rb_mWinSize = rb_define_module("Winsize");
|
7
|
+
rb_define_const(rb_mWinSize, "TIOCGWINSZ", ULONG2NUM(TIOCGWINSZ));
|
8
|
+
rb_define_const(rb_mWinSize, "TIOCSWINSZ", ULONG2NUM(TIOCSWINSZ));
|
9
9
|
}
|
data/lib/winsize.rb
CHANGED
@@ -9,6 +9,10 @@ module Winsize
|
|
9
9
|
@rows, @columns, @horizontal_pixels, @vertical_pixels = rows, columns, horizontal_pixels, vertical_pixels
|
10
10
|
end
|
11
11
|
|
12
|
+
def [](index)
|
13
|
+
[rows, columns][index]
|
14
|
+
end
|
15
|
+
|
12
16
|
def to_ioctl
|
13
17
|
[rows, columns, horizontal_pixels, vertical_pixels].pack("SSSS")
|
14
18
|
end
|
data/lib/winsize/version.rb
CHANGED
metadata
CHANGED
@@ -1,28 +1,26 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: winsize
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
4
5
|
prerelease:
|
5
|
-
version: 1.0.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Samuel Kadolph
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
date: 2011-05-24 00:00:00 Z
|
12
|
+
date: 2011-08-23 00:00:00.000000000Z
|
14
13
|
dependencies: []
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
description: ruby-winsize adds two methods (winsize and winsize=) to for use with
|
15
|
+
any IO instance for a TTY device. The Winsize::Winsize class is an intermediate
|
16
|
+
form that is used for ioctl calls to the TTY device.
|
17
|
+
email:
|
18
18
|
- samuel@kadolph.com
|
19
19
|
executables: []
|
20
|
-
|
21
|
-
extensions:
|
20
|
+
extensions:
|
22
21
|
- ext/extconf.rb
|
23
22
|
extra_rdoc_files: []
|
24
|
-
|
25
|
-
files:
|
23
|
+
files:
|
26
24
|
- ext/extconf.rb
|
27
25
|
- ext/winsize.c
|
28
26
|
- lib/winsize/version.rb
|
@@ -31,30 +29,27 @@ files:
|
|
31
29
|
- README.md
|
32
30
|
homepage: https://github.com/samuelkadolph/ruby-winsize
|
33
31
|
licenses: []
|
34
|
-
|
35
32
|
post_install_message:
|
36
33
|
rdoc_options: []
|
37
|
-
|
38
|
-
require_paths:
|
34
|
+
require_paths:
|
39
35
|
- lib
|
40
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
37
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version:
|
46
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
43
|
none: false
|
48
|
-
requirements:
|
49
|
-
- -
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
version:
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
52
48
|
requirements: []
|
53
|
-
|
54
49
|
rubyforge_project:
|
55
|
-
rubygems_version: 1.8.
|
50
|
+
rubygems_version: 1.8.6
|
56
51
|
signing_key:
|
57
52
|
specification_version: 3
|
58
|
-
summary: Small library that adds methods for getting and setting the winsize of any
|
53
|
+
summary: Small library that adds methods for getting and setting the winsize of any
|
54
|
+
TTY IO object.
|
59
55
|
test_files: []
|
60
|
-
|