window_blessing 0.0.1 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +30 -0
- data/README.md +1 -1
- data/bin/buffered_screen_demo.rb +4 -4
- data/bin/color_picker_demo.rb +1 -0
- data/bin/windowed_screen_demo.rb +1 -1
- data/bin/xterm_screen_demo.rb +6 -4
- data/lib/window_blessing.rb +2 -2
- data/lib/window_blessing/buffer.rb +16 -6
- data/lib/window_blessing/buffered_screen.rb +2 -2
- data/lib/window_blessing/color.rb +1 -0
- data/lib/window_blessing/debug_tools/log_request_redraw_internal.rb +16 -0
- data/lib/window_blessing/event_manager.rb +11 -6
- data/lib/window_blessing/evented.rb +1 -1
- data/lib/window_blessing/evented_variable.rb +10 -1
- data/lib/window_blessing/tools.rb +11 -1
- data/lib/window_blessing/version.rb +1 -1
- data/lib/window_blessing/widgets/draggable_background.rb +1 -1
- data/lib/window_blessing/widgets/label.rb +1 -1
- data/lib/window_blessing/widgets/slider.rb +10 -2
- data/lib/window_blessing/widgets/text_field.rb +1 -1
- data/lib/window_blessing/window.rb +48 -45
- data/lib/window_blessing/window_redraw_areas.rb +23 -0
- data/lib/window_blessing/windowed_screen.rb +11 -13
- data/lib/window_blessing/xterm_event_parser.rb +68 -59
- data/lib/window_blessing/xterm_screen.rb +2 -2
- data/lib/window_blessing/xterm_state.rb +1 -1
- data/spec/buffer_spec.rb +56 -0
- data/spec/color_spec.rb +14 -0
- data/spec/event_manager_spec.rb +107 -0
- data/spec/event_queue_spec.rb +46 -0
- data/spec/evented_variable_spec.rb +43 -0
- data/spec/tools_spec.rb +18 -0
- data/spec/window_redraw_areas_spec.rb +79 -0
- data/spec/window_spec.rb +138 -3
- data/spec/xterm_event_parser_spec.rb +86 -0
- data/window_blessing.gemspec +4 -3
- metadata +20 -11
- data/bin/foiled_demo.rb +0 -27
- data/bin/text_editor_demo.rb +0 -292
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module WindowBlessing
|
4
|
+
describe "EventQueue" do
|
5
|
+
include Tools
|
6
|
+
|
7
|
+
it "new" do
|
8
|
+
em = EventQueue.new
|
9
|
+
em.queue.should == []
|
10
|
+
end
|
11
|
+
|
12
|
+
it "<<" do
|
13
|
+
em = EventQueue.new
|
14
|
+
em << 1
|
15
|
+
em.queue.should == [1]
|
16
|
+
em << [2,3]
|
17
|
+
em.queue.should == [1,2,3]
|
18
|
+
end
|
19
|
+
|
20
|
+
it "clear" do
|
21
|
+
em = EventQueue.new
|
22
|
+
em << 1
|
23
|
+
em.clear
|
24
|
+
em.queue.should == []
|
25
|
+
end
|
26
|
+
|
27
|
+
it "clear" do
|
28
|
+
em = EventQueue.new
|
29
|
+
em.empty?.should == true
|
30
|
+
em << 1
|
31
|
+
em.empty?.should == false
|
32
|
+
em.clear
|
33
|
+
em.empty?.should == true
|
34
|
+
end
|
35
|
+
|
36
|
+
it "pop_all" do
|
37
|
+
em = EventQueue.new
|
38
|
+
em << 1
|
39
|
+
em << 2
|
40
|
+
a = em.pop_all
|
41
|
+
a.should == [1,2]
|
42
|
+
em.queue.should == []
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module WindowBlessing
|
4
|
+
describe "EventedVariable" do
|
5
|
+
include Tools
|
6
|
+
|
7
|
+
it "get" do
|
8
|
+
e = EventedVariable.new 4
|
9
|
+
e.get.should == 4
|
10
|
+
end
|
11
|
+
|
12
|
+
it "set (no listeners)" do
|
13
|
+
e = EventedVariable.new 4
|
14
|
+
e.set(5).should == 4
|
15
|
+
e.get.should == 5
|
16
|
+
end
|
17
|
+
|
18
|
+
it "inspect" do
|
19
|
+
e = EventedVariable.new 4
|
20
|
+
(!!e.inspect["4"]).should == true
|
21
|
+
end
|
22
|
+
|
23
|
+
it "set (with listeners)" do
|
24
|
+
e = EventedVariable.new 4
|
25
|
+
handled = ""
|
26
|
+
e.on(:change) {handled+="c"}
|
27
|
+
e.on(:refresh) {handled+="r"}
|
28
|
+
e.set(5).should == 4
|
29
|
+
e.get.should == 5
|
30
|
+
handled.should == "rc"
|
31
|
+
end
|
32
|
+
|
33
|
+
it "refresh (with listeners)" do
|
34
|
+
e = EventedVariable.new 4
|
35
|
+
handled = ""
|
36
|
+
e.on(:change) {handled+="c"}
|
37
|
+
e.on(:refresh) {handled+="r"}
|
38
|
+
e.refresh(5).should == 4
|
39
|
+
e.get.should == 5
|
40
|
+
handled.should == "r"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/spec/tools_spec.rb
CHANGED
@@ -138,5 +138,23 @@ describe "Tools" do
|
|
138
138
|
gen_array2d(point(3,3), [1, 2]).should == [[1,2,1], [2,1,2], [1,2,1]]
|
139
139
|
gen_array2d(point(4,4), [1, 2, 3]).should == [[1, 2, 3, 1], [2, 3, 1, 2], [3, 1, 2, 3], [1,2,3,1]]
|
140
140
|
end
|
141
|
+
|
142
|
+
it "clone_value" do
|
143
|
+
clone_value(0.5).should == 0.5
|
144
|
+
clone_value(nil).should == nil
|
145
|
+
clone_value(100).should == 100
|
146
|
+
v2 = clone_value v1 = {foo: "bar"}
|
147
|
+
v1[:foo] = "baz"
|
148
|
+
v1[:foo].should_not == v2[:foo]
|
149
|
+
end
|
150
|
+
|
151
|
+
it "range_length" do
|
152
|
+
range_length(0..-1).should == nil
|
153
|
+
range_length(-1..0).should == nil
|
154
|
+
range_length(-2..-1).should == 2
|
155
|
+
range_length(0..2).should == 3
|
156
|
+
range_length(1..2).should == 2
|
157
|
+
range_length(1...2).should == 1
|
158
|
+
end
|
141
159
|
end
|
142
160
|
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module WindowBlessing
|
4
|
+
describe "WindowRedrawAreas" do
|
5
|
+
include Tools
|
6
|
+
|
7
|
+
it "basic init" do
|
8
|
+
wra = WindowRedrawAreas.new
|
9
|
+
wra.areas.should == []
|
10
|
+
wra << rect(5,5,10,10)
|
11
|
+
wra.areas.should == [rect(5,5,10,10)]
|
12
|
+
end
|
13
|
+
|
14
|
+
it "two non overlapping areas" do
|
15
|
+
wra = WindowRedrawAreas.new
|
16
|
+
wra << rect(5,5,10,10)
|
17
|
+
wra << rect(50,5,10,10)
|
18
|
+
wra.areas.should == [rect(5,5,10,10),rect(50,5,10,10)]
|
19
|
+
end
|
20
|
+
|
21
|
+
it "two overlapping areas" do
|
22
|
+
wra = WindowRedrawAreas.new
|
23
|
+
wra << rect(5,5,10,10)
|
24
|
+
wra << rect(10,5,10,10)
|
25
|
+
wra.areas.should == [rect(5,5,15,10)]
|
26
|
+
end
|
27
|
+
|
28
|
+
it "three areas collaps to one" do
|
29
|
+
wra = WindowRedrawAreas.new
|
30
|
+
wra << rect(0,0,2,10)
|
31
|
+
wra << rect(2,5,5,5)
|
32
|
+
wra.areas.should == [rect(0,0,2,10),rect(2,5,5,5)]
|
33
|
+
wra << rect(0,9,3,1)
|
34
|
+
wra.areas.should == [rect(0,0,7,10)]
|
35
|
+
end
|
36
|
+
|
37
|
+
it "tl overlap" do
|
38
|
+
wra = WindowRedrawAreas.new
|
39
|
+
wra << rect(5,5,10,10)
|
40
|
+
wra << rect(0,0,10,10)
|
41
|
+
wra.areas.should == [rect(0,0,15,15)]
|
42
|
+
end
|
43
|
+
|
44
|
+
it "tr overlap" do
|
45
|
+
wra = WindowRedrawAreas.new
|
46
|
+
wra << rect(5,5,10,10)
|
47
|
+
wra << rect(10,0,10,10)
|
48
|
+
wra.areas.should == [rect(5,0,15,15)]
|
49
|
+
end
|
50
|
+
|
51
|
+
it "bl overlap" do
|
52
|
+
wra = WindowRedrawAreas.new
|
53
|
+
wra << rect(5,5,10,10)
|
54
|
+
wra << rect(0,10,10,10)
|
55
|
+
wra.areas.should == [rect(0,5,15,15)]
|
56
|
+
end
|
57
|
+
|
58
|
+
it "br overlap" do
|
59
|
+
wra = WindowRedrawAreas.new
|
60
|
+
wra << rect(5,5,10,10)
|
61
|
+
wra << rect(10,10,10,10)
|
62
|
+
wra.areas.should == [rect(5,5,15,15)]
|
63
|
+
end
|
64
|
+
|
65
|
+
it "just barely no overlap" do
|
66
|
+
wra = WindowRedrawAreas.new
|
67
|
+
wra << rect(5,5,5,10)
|
68
|
+
wra << rect(10,5,5,10)
|
69
|
+
wra.areas.should == [rect(5,5,5,10),rect(10,5,5,10)]
|
70
|
+
end
|
71
|
+
|
72
|
+
it "just barely overlap" do
|
73
|
+
wra = WindowRedrawAreas.new
|
74
|
+
wra << rect(5,5,5,10)
|
75
|
+
wra << rect(9,5,5,10)
|
76
|
+
wra.areas.should == [rect(5,5,9,10)]
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/spec/window_spec.rb
CHANGED
@@ -25,7 +25,7 @@ describe "Window" do
|
|
25
25
|
w = window rect(0,0,4,4)
|
26
26
|
c = window rect(1,1,1,2)
|
27
27
|
c.buffer.contents = "*\n*"
|
28
|
-
c.
|
28
|
+
c.clear_redraw_areas
|
29
29
|
w.add_child c
|
30
30
|
w.draw
|
31
31
|
w.buffer.to_s.should == " \n * \n * \n "
|
@@ -44,8 +44,8 @@ describe "Window" do
|
|
44
44
|
w = window rect(0,0,4,4)
|
45
45
|
(c1=w.add_child(window(rect(1,1,2,2)))).buffer.fill :string=>"*"
|
46
46
|
(c2=w.add_child(window(rect(2,0,2,2)))).buffer.fill :string=>"@"
|
47
|
-
c1.
|
48
|
-
c2.
|
47
|
+
c1.clear_redraw_areas
|
48
|
+
c2.clear_redraw_areas
|
49
49
|
w.draw
|
50
50
|
w.buffer.to_s.should == " @@\n *@@\n ** \n "
|
51
51
|
end
|
@@ -57,5 +57,140 @@ describe "Window" do
|
|
57
57
|
w.each_child.collect{|a|a}.should == [c1,c2]
|
58
58
|
w.each_child_with_index.collect{|a,i|[a,i]}.should == [[c1,0],[c2,1]]
|
59
59
|
end
|
60
|
+
|
61
|
+
it "route_poiner_event" do
|
62
|
+
w1 = window rect(0,0,10,10)
|
63
|
+
w2 = window rect(2,0,4,4)
|
64
|
+
w1.add_child w2
|
65
|
+
handled = ""
|
66
|
+
w1.on(:pointer) {handled+="w1"}
|
67
|
+
w2.on(:pointer) {handled+="w2"}
|
68
|
+
w1.route_pointer_event type: :pointer, loc: point()
|
69
|
+
handled.should == "w1"
|
70
|
+
|
71
|
+
handled=""
|
72
|
+
w1.route_pointer_event type: :pointer, loc: point(2,0)
|
73
|
+
handled.should == "w1"
|
74
|
+
|
75
|
+
handled=""
|
76
|
+
w1.route_pointer_event type: [:pointer, :button_up], loc: point(2,0)
|
77
|
+
handled.should == "w1"
|
78
|
+
|
79
|
+
handled=""
|
80
|
+
w1.route_pointer_event type: :pointer, loc: point(2,0)
|
81
|
+
handled.should == "w2"
|
82
|
+
end
|
83
|
+
|
84
|
+
it "blur and focus" do
|
85
|
+
w1 = window rect(0,0,10,10)
|
86
|
+
w2 = window rect(2,0,4,4)
|
87
|
+
w3 = window rect(0,2,4,4)
|
88
|
+
w4 = window rect(0,2,4,4)
|
89
|
+
w1.add_child w2
|
90
|
+
w2.add_child w4
|
91
|
+
w1.add_child w3
|
92
|
+
|
93
|
+
handled = ""
|
94
|
+
w1.on(:focus) {handled+="w1f"}
|
95
|
+
w1.on(:blur) {handled+="w1b"}
|
96
|
+
w2.on(:focus) {handled+="w2f"}
|
97
|
+
w2.on(:blur) {handled+="w2b"}
|
98
|
+
w3.on(:focus) {handled+="w3f"}
|
99
|
+
w3.on(:blur) {handled+="w3b"}
|
100
|
+
w4.on(:focus) {handled+="w4f"}
|
101
|
+
w4.on(:blur) {handled+="w4b"}
|
102
|
+
|
103
|
+
w1.focus
|
104
|
+
handled.should == "w1f"
|
105
|
+
|
106
|
+
handled = ""
|
107
|
+
w4.focus
|
108
|
+
handled.should == "w2fw4f"
|
109
|
+
|
110
|
+
handled = ""
|
111
|
+
w3.focus
|
112
|
+
handled.should == "w4bw2bw3f"
|
113
|
+
end
|
114
|
+
|
115
|
+
it "move and redraw" do
|
116
|
+
w1 = window rect(0,0,10,10)
|
117
|
+
w2 = window rect(2,0,4,4)
|
118
|
+
w1.add_child w2
|
119
|
+
w1.draw
|
120
|
+
|
121
|
+
w1.redraw_requested?.should == false
|
122
|
+
w2.redraw_requested?.should == false
|
123
|
+
|
124
|
+
w2.area = rect(0,0,4,4)
|
125
|
+
w1.redraw_requested?.should == true
|
126
|
+
w2.redraw_requested?.should == false
|
127
|
+
end
|
128
|
+
|
129
|
+
it "resize smaller and redraw" do
|
130
|
+
w1 = window rect(0,0,10,10)
|
131
|
+
w2 = window rect(2,0,4,4)
|
132
|
+
w1.add_child w2
|
133
|
+
w1.draw
|
134
|
+
|
135
|
+
w1.redraw_requested?.should == false
|
136
|
+
w2.redraw_requested?.should == false
|
137
|
+
|
138
|
+
w2.area = rect(2,0,4,3)
|
139
|
+
w1.redraw_requested?.should == true
|
140
|
+
w2.redraw_requested?.should == false
|
141
|
+
end
|
142
|
+
|
143
|
+
it "resize larger and redraw" do
|
144
|
+
w1 = window rect(0,0,10,10)
|
145
|
+
w2 = window rect(2,0,4,4)
|
146
|
+
w1.add_child w2
|
147
|
+
w1.draw
|
148
|
+
|
149
|
+
w1.redraw_requested?.should == false
|
150
|
+
w2.redraw_requested?.should == false
|
151
|
+
|
152
|
+
w2.area = rect(2,0,4,5)
|
153
|
+
w1.redraw_requested?.should == true
|
154
|
+
w2.redraw_requested?.should == true
|
155
|
+
end
|
156
|
+
|
157
|
+
it "redirect_keyboard_event" do
|
158
|
+
w1 = window rect(0,0,10,10)
|
159
|
+
w2 = window rect(2,0,4,4)
|
160
|
+
w1.add_child w2
|
161
|
+
|
162
|
+
handled = ""
|
163
|
+
w1.on(:key_press) {handled+="w1kp"}
|
164
|
+
w2.on(:key_press) {handled+="w2kp"}
|
165
|
+
|
166
|
+
w1.route_keyboard_event type: :key_press
|
167
|
+
handled.should == "w1kp"
|
168
|
+
|
169
|
+
handled = ""
|
170
|
+
w2.focus
|
171
|
+
w1.route_keyboard_event type: :key_press
|
172
|
+
handled.should == "w2kpw1kp"
|
173
|
+
end
|
174
|
+
|
175
|
+
it "path & parent_path" do
|
176
|
+
w1 = window rect(0,0,10,10)
|
177
|
+
w2 = window rect(2,0,4,4)
|
178
|
+
w1.add_child w2
|
179
|
+
w1.name = "foo"
|
180
|
+
w2.name = "bar"
|
181
|
+
|
182
|
+
w2.path.should == "WindowBlessing::Window(0,0,10,10):foo,WindowBlessing::Window(2,0,4,4):bar"
|
183
|
+
w2.parent_path.should == "WindowBlessing::Window(0,0,10,10):foo"
|
184
|
+
end
|
185
|
+
|
186
|
+
it "move_onscreen" do
|
187
|
+
w1 = window rect(0,0,10,10)
|
188
|
+
w2 = window rect(8,0,4,4)
|
189
|
+
w1.add_child w2
|
190
|
+
|
191
|
+
w2.move_onscreen
|
192
|
+
w2.area.should == rect(6,0,4,4)
|
193
|
+
|
194
|
+
end
|
60
195
|
end
|
61
196
|
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module WindowBlessing
|
4
|
+
describe "XtermEventParser" do
|
5
|
+
include Tools
|
6
|
+
|
7
|
+
def parse(str)
|
8
|
+
events = XtermEventParser.new.parse(str).events
|
9
|
+
events.length.should == 1
|
10
|
+
events[0]
|
11
|
+
end
|
12
|
+
|
13
|
+
it "blur and focus" do
|
14
|
+
{:type=>:blur, :raw=>"\e[O"}.should == parse("\e[O")
|
15
|
+
{:type=>:focus, :raw=>"\e[I"}.should == parse("\e[I")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "escape, tab, enter/return" do
|
19
|
+
{:type=>[:key_press, :escape], :key=>:escape, :raw=>"\e"}.should == parse("\e")
|
20
|
+
{:type=>[:key_press, :enter], :key=>:enter, :raw=>"\r"}.should == parse("\r")
|
21
|
+
{:type=>[:key_press, :tab], :key=>:tab, :raw=>"\t"}.should == parse("\t")
|
22
|
+
{:type=>[:key_press, :reverse_tab], :key=>:reverse_tab, :raw=>"\e[Z"}.should == parse("\e[Z")
|
23
|
+
end
|
24
|
+
|
25
|
+
it "arrow keys" do
|
26
|
+
{:type=>[:key_press, :down], :key=>:down, :alt=>true, :raw=>"\e\e[B"}.should == parse("\e\e[B")
|
27
|
+
{:type=>[:key_press, :down], :key=>:down, :raw=>"\e[B"}.should == parse("\e[B")
|
28
|
+
{:type=>[:key_press, :down], :key=>:down, :shift=>true, :alt=>true, :raw=>"\e[1;10B"}.should == parse("\e[1;10B")
|
29
|
+
{:type=>[:key_press, :down], :key=>:down, :shift=>true, :raw=>"\e[1;2B"}.should == parse("\e[1;2B")
|
30
|
+
{:type=>[:key_press, :left], :key=>:left, :alt=>true, :raw=>"\e\e[D"}.should == parse("\e\e[D")
|
31
|
+
{:type=>[:key_press, :left], :key=>:left, :raw=>"\e[D"}.should == parse("\e[D")
|
32
|
+
{:type=>[:key_press, :left], :key=>:left, :shift=>true, :alt=>true, :raw=>"\e[1;10D"}.should == parse("\e[1;10D")
|
33
|
+
{:type=>[:key_press, :left], :key=>:left, :shift=>true, :raw=>"\e[1;2D"}.should == parse("\e[1;2D")
|
34
|
+
{:type=>[:key_press, :right], :key=>:right, :alt=>true, :raw=>"\e\e[C"}.should == parse("\e\e[C")
|
35
|
+
{:type=>[:key_press, :right], :key=>:right, :raw=>"\e[C"}.should == parse("\e[C")
|
36
|
+
{:type=>[:key_press, :right], :key=>:right, :shift=>true, :alt=>true, :raw=>"\e[1;10C"}.should == parse("\e[1;10C")
|
37
|
+
{:type=>[:key_press, :right], :key=>:right, :shift=>true, :raw=>"\e[1;2C"}.should == parse("\e[1;2C")
|
38
|
+
{:type=>[:key_press, :up], :key=>:up, :alt=>true, :raw=>"\e\e[A"}.should == parse("\e\e[A")
|
39
|
+
{:type=>[:key_press, :up], :key=>:up, :raw=>"\e[A"}.should == parse("\e[A")
|
40
|
+
{:type=>[:key_press, :up], :key=>:up, :shift=>true, :alt=>true, :raw=>"\e[1;10A"}.should == parse("\e[1;10A")
|
41
|
+
{:type=>[:key_press, :up], :key=>:up, :shift=>true, :raw=>"\e[1;2A"}.should == parse("\e[1;2A")
|
42
|
+
end
|
43
|
+
|
44
|
+
it "control-a" do
|
45
|
+
{:type=>:key_press, :key=>:a, :control=>true, :raw=>"\x01"}.should == parse("\x01")
|
46
|
+
end
|
47
|
+
|
48
|
+
it "size" do
|
49
|
+
{:type=>:xterm_state, :state_type=>:size, :state=>point(99,68), :raw=>"\e[8;68;99t"}.should == parse("\e[8;68;99t")
|
50
|
+
end
|
51
|
+
|
52
|
+
it "f-keys" do
|
53
|
+
{:type=>[:key_press, :f1], :key=>:f1, :raw=>"\eOP"}.should == parse("\eOP")
|
54
|
+
{:type=>[:key_press, :f1], :key=>:f1, :shift=>true, :raw=>"\e[1;2P"}.should == parse("\e[1;2P")
|
55
|
+
{:type=>[:key_press, :f2], :key=>:f2, :raw=>"\eOQ"}.should == parse("\eOQ")
|
56
|
+
{:type=>[:key_press, :f2], :key=>:f2, :shift=>true, :raw=>"\e[1;2Q"}.should == parse("\e[1;2Q")
|
57
|
+
{:type=>[:key_press, :f3], :key=>:f3, :raw=>"\eOR"}.should == parse("\eOR")
|
58
|
+
{:type=>[:key_press, :f3], :key=>:f3, :shift=>true, :raw=>"\e[1;2R"}.should == parse("\e[1;2R")
|
59
|
+
{:type=>[:key_press, :f4], :key=>:f4, :raw=>"\eOS"}.should == parse("\eOS")
|
60
|
+
{:type=>[:key_press, :f4], :key=>:f4, :shift=>true, :raw=>"\e[1;2S"}.should == parse("\e[1;2S")
|
61
|
+
{:type=>[:key_press, :f5], :key=>:f5, :shift=>false, :raw=>"\e[15~"}.should == parse("\e[15~")
|
62
|
+
{:type=>[:key_press, :f5], :key=>:f5, :shift=>true, :raw=>"\e[15;2~"}.should == parse("\e[15;2~")
|
63
|
+
{:type=>[:key_press, :f6], :key=>:f6, :shift=>false, :raw=>"\e[17~"}.should == parse("\e[17~")
|
64
|
+
{:type=>[:key_press, :f6], :key=>:f6, :shift=>true, :raw=>"\e[17;2~"}.should == parse("\e[17;2~")
|
65
|
+
{:type=>[:key_press, :f7], :key=>:f7, :shift=>false, :raw=>"\e[18~"}.should == parse("\e[18~")
|
66
|
+
{:type=>[:key_press, :f7], :key=>:f7, :shift=>true, :raw=>"\e[18;2~"}.should == parse("\e[18;2~")
|
67
|
+
{:type=>[:key_press, :f8], :key=>:f8, :shift=>false, :raw=>"\e[19~"}.should == parse("\e[19~")
|
68
|
+
{:type=>[:key_press, :f8], :key=>:f8, :shift=>true, :raw=>"\e[19;2~"}.should == parse("\e[19;2~")
|
69
|
+
{:type=>[:key_press, :f9], :key=>:f9, :shift=>false, :raw=>"\e[20~"}.should == parse("\e[20~")
|
70
|
+
{:type=>[:key_press, :f9], :key=>:f9, :shift=>true, :raw=>"\e[20;2~"}.should == parse("\e[20;2~")
|
71
|
+
{:type=>[:key_press, :f10], :key=>:f10, :shift=>false, :raw=>"\e[21~"}.should == parse("\e[21~")
|
72
|
+
{:type=>[:key_press, :f10], :key=>:f10, :shift=>true, :raw=>"\e[21;2~"}.should == parse("\e[21;2~")
|
73
|
+
end
|
74
|
+
|
75
|
+
it "mouse" do
|
76
|
+
{:type=>[:pointer, :button_down, 1], :button=>[:button_down, 1], :state=>32, :loc=>point(23,51), :shift=>false, :alt=>false, :control=>false, :raw=>"\e[M 8T"}.should == parse("\e[M 8T")
|
77
|
+
{:type=>[:pointer, :button_up], :button=>:button_up, :state=>35, :loc=>point(33,50), :shift=>false, :alt=>false, :control=>false, :raw=>"\e[M#BS"}.should == parse("\e[M#BS")
|
78
|
+
{:type=>[:pointer, :button_down, 1], :button=>[:button_down, 1], :state=>36, :loc=>point(22,31), :shift=>true, :alt=>false, :control=>false, :raw=>"\e[M$7@"}.should == parse("\e[M$7@")
|
79
|
+
{:type=>[:pointer, :button_up], :button=>:button_up, :state=>39, :loc=>point(22,31), :shift=>true, :alt=>false, :control=>false, :raw=>"\e[M'7@"}.should == parse("\e[M'7@")
|
80
|
+
{:type=>[:pointer, :drag], :button=>:drag, :state=>64, :loc=>point(24,51), :shift=>false, :alt=>false, :control=>false, :raw=>"\e[M@9T"}.should == parse("\e[M@9T")
|
81
|
+
{:type=>[:pointer, :drag], :button=>:drag, :state=>68, :loc=>point(34,30), :shift=>true, :alt=>false, :control=>false, :raw=>"\e[MDC?"}.should == parse("\e[MDC?")
|
82
|
+
{:type=>[:pointer, :wheel_down], :button=>:wheel_down, :state=>96, :loc=>point(28,44), :shift=>false, :alt=>false, :control=>false, :raw=>"\e[M`=M"}.should == parse("\e[M`=M")
|
83
|
+
{:type=>[:pointer, :wheel_up], :button=>:wheel_up, :state=>97, :loc=>point(28,44), :shift=>false, :alt=>false, :control=>false, :raw=>"\e[Ma=M"}.should == parse("\e[Ma=M")
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
data/window_blessing.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = WindowBlessing::VERSION
|
9
9
|
gem.authors = ["Shane Brinkman-Davis"]
|
10
10
|
gem.email = ["shanebdavis@gmail.com"]
|
11
|
-
gem.description = "Forget
|
12
|
-
gem.summary = ""
|
11
|
+
gem.description = "Forget curses. Try blessings. WindowBlessing is an evented, windowing framework for terminal apps."
|
12
|
+
gem.summary = "Evented windowing framework for terminal apps."
|
13
13
|
gem.homepage = "https://github.com/shanebdavis/window_blessing"
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
@@ -18,7 +18,8 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
20
|
gem.add_dependency 'babel_bridge', ">= 0.5.3"
|
21
|
-
gem.add_dependency 'gui_geometry', ">= 0.
|
21
|
+
gem.add_dependency 'gui_geometry', ">= 0.3.1"
|
22
|
+
|
22
23
|
gem.add_development_dependency 'rake'
|
23
24
|
gem.add_development_dependency 'rspec'
|
24
25
|
gem.add_development_dependency 'guard-rspec'
|