vedeu 0.4.20 → 0.4.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c7cd26a499c374db75b879fd68895f3556128d7
4
- data.tar.gz: eb83922ae30bc67dd8dd4c85f5187b677db16168
3
+ metadata.gz: 6d59258ed8c80d1a0edbe50022689de2cdd6b0ae
4
+ data.tar.gz: 68f3f7a8bbde59807faa8c9517400f4d43d0c127
5
5
  SHA512:
6
- metadata.gz: f0e7347e6b8b32abd258f387ffb16dfedba70a02969bd441d66c0075429b53da21337e990159daf02763dbf77342a42a1ea6b95bf0ee6f427858fa2717a124e3
7
- data.tar.gz: 14583143e3615ad64da7c574403882ec6a40dea16445990c0f892322a9839cd670caa91e107be0171c8d34ecb65656285fb92ee2114a60de8516f342732707de
6
+ metadata.gz: 6841e54f8ca0cc71018cf628d0384bc1c250e608505ce55881391130358b9296e1716a3adde7863cf41370c4416e4fe7126b232976a83d8173166cd2c2384d62
7
+ data.tar.gz: 50c7fcc0dbd3e42e54dce9367e3fb1af1443a7e853dce4614ed25cbee41f2621a7e4a1624daf3b61285f6c0f8caff7341728f2b7144102feaca8a8b98c01186f
@@ -32,6 +32,9 @@ class VedeuCursorApp
32
32
  key(:right, 'l') { Vedeu.trigger(:_cursor_right_) }
33
33
  key(:down, 'j') { Vedeu.trigger(:_cursor_down_) }
34
34
  key(:left, 'h') { Vedeu.trigger(:_cursor_left_) }
35
+
36
+ key('m') { Vedeu.trigger(:_maximise_, 'main_interface') }
37
+ key('u') { Vedeu.trigger(:_unmaximise_, 'main_interface') }
35
38
  end
36
39
 
37
40
  renders do
@@ -262,6 +262,26 @@ module Vedeu
262
262
  end
263
263
  end
264
264
 
265
+ # Will maximise the named interface geometry. This means it will occupy all
266
+ # of the available space on the terminal window.
267
+ Vedeu.bind(:_maximise_) do |name|
268
+ Vedeu.geometries.by_name(name).maximise
269
+
270
+ Vedeu.trigger(:_refresh_, name)
271
+ end
272
+
273
+ # Will unmaximise the named interface geometry. Previously, if a geometry
274
+ # was maximised, then triggering the unmaximise event will return it to its
275
+ # usual defined size (terminal size permitting: if the terminal has been
276
+ # resized, then the new geometry size should adapt).
277
+ Vedeu.bind(:_unmaximise_) do |name|
278
+ Vedeu.trigger(:_clear_, name)
279
+
280
+ Vedeu.geometries.by_name(name).unmaximise
281
+
282
+ Vedeu.trigger(:_refresh_, name)
283
+ end
284
+
265
285
  end # Bindings
266
286
  # :nocov:
267
287
 
@@ -63,7 +63,10 @@ module Vedeu
63
63
 
64
64
  # @return [Array<Fixnum>]
65
65
  def dimension
66
- @dimension ||= if centred? && length?
66
+ @dimension ||= if maximised?
67
+ [1, default]
68
+
69
+ elsif centred? && length?
67
70
  [centred_d, centred_dn]
68
71
 
69
72
  else
@@ -128,6 +131,11 @@ module Vedeu
128
131
  end
129
132
  end
130
133
 
134
+ # @return [Boolean]
135
+ def maximised?
136
+ options[:maximised]
137
+ end
138
+
131
139
  # @return [Hash<Symbol => Boolean>]
132
140
  def options
133
141
  defaults.merge!(@options)
@@ -136,7 +144,8 @@ module Vedeu
136
144
  # @return [Hash<Symbol => Boolean>]
137
145
  def defaults
138
146
  {
139
- centred: false,
147
+ centred: false,
148
+ maximised: false,
140
149
  }
141
150
  end
142
151
 
@@ -58,6 +58,10 @@ module Vedeu
58
58
  # @return [Fixnum]
59
59
  attr_writer :height
60
60
 
61
+ # @!attribute [rw] maximised
62
+ # @return [Boolean]
63
+ attr_accessor :maximised
64
+
61
65
  # @!attribute [w] width
62
66
  # @return [Fixnum]
63
67
  attr_writer :width
@@ -94,34 +98,50 @@ module Vedeu
94
98
  def initialize(attributes = {})
95
99
  @attributes = defaults.merge!(attributes)
96
100
 
97
- @attributes.each do |key, value|
98
- instance_variable_set("@#{key}", value)
99
- end
101
+ @attributes.each { |key, value| instance_variable_set("@#{key}", value) }
102
+ end
103
+
104
+ # @return [Vedeu::Geometry]
105
+ def maximise
106
+ @maximised = true
107
+
108
+ store
109
+ end
110
+
111
+ # @return [Vedeu::Geometry]
112
+ def unmaximise
113
+ @maximised = false
114
+
115
+ store
100
116
  end
101
117
 
102
118
  private
103
119
 
104
120
  # @return [Vedeu::Area]
105
121
  def area
106
- @area ||= Vedeu::Area.from_dimensions(y_yn: y_yn, x_xn: x_xn)
122
+ Vedeu::Area.from_dimensions(y_yn: y_yn, x_xn: x_xn)
107
123
  end
108
124
 
109
125
  # @return [Array<Fixnum>]
110
126
  def x_xn
111
- @x_xn ||= Vedeu::Dimension.pair(d: _x,
112
- dn: _xn,
113
- d_dn: @width,
114
- default: Vedeu::Terminal.width,
115
- options: { centred: centred })
127
+ Vedeu::Dimension.pair(d: _x,
128
+ dn: _xn,
129
+ d_dn: @width,
130
+ default: Vedeu::Terminal.width,
131
+ options: {
132
+ centred: centred,
133
+ maximised: maximised })
116
134
  end
117
135
 
118
136
  # @return [Array<Fixnum>]
119
137
  def y_yn
120
- @y_yn ||= Vedeu::Dimension.pair(d: _y,
121
- dn: _yn,
122
- d_dn: @height,
123
- default: Vedeu::Terminal.height,
124
- options: { centred: centred })
138
+ Vedeu::Dimension.pair(d: _y,
139
+ dn: _yn,
140
+ d_dn: @height,
141
+ default: Vedeu::Terminal.height,
142
+ options: {
143
+ centred: centred,
144
+ maximised: maximised })
125
145
  end
126
146
 
127
147
  # Returns the row/line start position for the interface.
@@ -157,6 +177,7 @@ module Vedeu
157
177
  {
158
178
  centred: nil,
159
179
  height: nil,
180
+ maximised: false,
160
181
  name: nil,
161
182
  repository: Vedeu.geometries,
162
183
  width: nil,
@@ -23,6 +23,10 @@ module Vedeu
23
23
  :height,
24
24
  :width
25
25
 
26
+ # @!attribute [rw] maximise
27
+ # @return [Boolean]
28
+ attr_accessor :maximised
29
+
26
30
  # @!attribute [r] name
27
31
  # @return [String|NilClass]
28
32
  attr_reader :name
@@ -11,7 +11,7 @@ module Vedeu
11
11
  describe '#initialize' do
12
12
  subject { instance }
13
13
 
14
- it { subject.must_be_instance_of(Vedeu::Subprocess) }
14
+ it { subject.must_be_instance_of(described) }
15
15
  it do
16
16
  subject.instance_variable_get('@application').must_equal(application)
17
17
  end
@@ -39,6 +39,13 @@ module Vedeu
39
39
  it { subject.must_be_instance_of(Array) }
40
40
  it { subject.must_equal([15, 38]) }
41
41
 
42
+ context 'when maximised' do
43
+ let(:options) { { maximised: true } }
44
+ let(:default) { 80 }
45
+
46
+ it { subject.must_equal([1, 80]) }
47
+ end
48
+
42
49
  context 'when centred and a length can be determined' do
43
50
  let(:options) { { centred: true } }
44
51
  let(:default) { 80 }
@@ -10,6 +10,7 @@ module Vedeu
10
10
  {
11
11
  centred: centred,
12
12
  height: height,
13
+ maximised: maximised,
13
14
  name: _name,
14
15
  repository: Vedeu.geometries,
15
16
  width: width,
@@ -19,14 +20,15 @@ module Vedeu
19
20
  yn: yn,
20
21
  }
21
22
  }
22
- let(:centred) {}
23
- let(:height) {}
24
- let(:_name) {}
25
- let(:width) {}
26
- let(:x) {}
27
- let(:xn) {}
28
- let(:y) {}
29
- let(:yn) {}
23
+ let(:centred) {}
24
+ let(:height) {}
25
+ let(:maximised) {}
26
+ let(:_name) {}
27
+ let(:width) {}
28
+ let(:x) {}
29
+ let(:xn) {}
30
+ let(:y) {}
31
+ let(:yn) {}
30
32
 
31
33
  before { Terminal.stubs(:size).returns([12, 40]) }
32
34
 
@@ -48,7 +50,50 @@ module Vedeu
48
50
  end
49
51
  end
50
52
 
53
+ describe '#maximise' do
54
+ let(:attributes) {
55
+ {
56
+ height: 6,
57
+ maximised: false,
58
+ name: 'maximise',
59
+ width: 18
60
+ }
61
+ }
62
+
63
+ subject { instance.maximise }
64
+
65
+ it { subject.must_be_instance_of(described) }
66
+
67
+ it { subject.maximised.must_equal(true) }
68
+ end
69
+
70
+ describe '#unmaximise' do
71
+ let(:attributes) {
72
+ {
73
+ height: 6,
74
+ maximised: true,
75
+ name: 'unmaximise',
76
+ width: 18
77
+ }
78
+ }
79
+
80
+ subject { instance.unmaximise }
81
+
82
+ it { subject.must_be_instance_of(described) }
83
+
84
+ it { subject.maximised.must_equal(false) }
85
+ end
86
+
51
87
  describe '#top, #right, #bottom, #left' do
88
+ context 'maximised is true' do
89
+ let(:attributes) { { maximised: true } }
90
+
91
+ it { instance.top.must_equal(1) }
92
+ it { instance.right.must_equal(40) }
93
+ it { instance.bottom.must_equal(12) }
94
+ it { instance.left.must_equal(1) }
95
+ end
96
+
52
97
  context 'centred is true' do
53
98
  let(:attributes) { { height: 6, width: 18, centred: true } }
54
99
 
@@ -18,7 +18,7 @@ module Vedeu
18
18
  describe '#initialize' do
19
19
  subject { instance }
20
20
 
21
- it { subject.must_be_instance_of(Group) }
21
+ it { subject.must_be_instance_of(described) }
22
22
  it {
23
23
  subject.instance_variable_get('@attributes').must_be_instance_of(Hash)
24
24
  }
@@ -33,6 +33,7 @@ module Vedeu
33
33
  describe '#initialize' do
34
34
  subject { instance }
35
35
 
36
+ it { subject.must_be_instance_of(described) }
36
37
  it { subject.instance_variable_get('@client').must_equal(client) }
37
38
  it { subject.instance_variable_get('@delay').must_equal(delay) }
38
39
  it { subject.instance_variable_get('@group').must_equal(group) }
@@ -11,7 +11,7 @@ module Vedeu
11
11
  let(:_name) {}
12
12
 
13
13
  describe '#initialize' do
14
- it { instance.must_be_instance_of(Vedeu::Null::Interface) }
14
+ it { instance.must_be_instance_of(described) }
15
15
  it { instance.instance_variable_get('@name').must_equal(_name) }
16
16
  end
17
17
 
data/vedeu.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'vedeu'
7
- spec.version = '0.4.20'
7
+ spec.version = '0.4.21'
8
8
  spec.authors = ['Gavin Laking']
9
9
  spec.email = ['gavinlaking@gmail.com']
10
10
  spec.summary = 'A terminal case of wonderland.'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.20
4
+ version: 0.4.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking