vedeu 0.6.49 → 0.6.50

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: 40290f698e67f6437fbc9b2727e8cdfe54d68a6d
4
- data.tar.gz: 259c3305848dd4a9dc9b58332051ebf4987b1f99
3
+ metadata.gz: 3656fd2ea030549ea6a2a7b436f3d4e0b30b4cae
4
+ data.tar.gz: 7d1ae15fec3a67bda3e62bd0777c9e38c69dc35f
5
5
  SHA512:
6
- metadata.gz: 34e50c0fa3539b628e7592fb0f19b4d9cc20ff7a3d9808bcb515c24fb06c8590e1e26f73c538276716bdc33f1296aa1c9ba710cd768d2ec6409de7cb19b574a4
7
- data.tar.gz: 234914b85448331f85d85db2b754b917d71c5e7c76675a5d1ce68fd2af8c37ca3f7701ad76d2df0eb017d99b76b6bf078b1e438cbd7798b751184fb31ada2d09
6
+ metadata.gz: 828e104fc823104f930edbcea3e8dfff7f66b485fc07abc2124fe543a8ebc4d78ac491b3ba7119322417bb7b44c383e31cbd6a83cd6f96daef055a231a53638f
7
+ data.tar.gz: 1d8398ed1312cd0da093e3ba370904bf05e34cd6fee2e6d49b633890d4691e6cb73f546458721bd6648ebb829a743aeb14f36be40963bac5d93a57aa79b80ab3
@@ -555,6 +555,25 @@ module Vedeu
555
555
  options
556
556
  end
557
557
 
558
+ # Sets boolean to enable/disable mouse support.
559
+ #
560
+ # Vedeu.configure do
561
+ # mouse! # => same as `mouse true`
562
+ #
563
+ # # or...
564
+ # mouse true
565
+ #
566
+ # mouse false
567
+ #
568
+ # end
569
+ #
570
+ # @param value [Boolean]
571
+ # @return [Boolean]
572
+ def mouse!(value = true)
573
+ options[:mouse] = value
574
+ end
575
+ alias_method :mouse, :mouse!
576
+
558
577
  private
559
578
 
560
579
  # @param attrs [Hash<Symbol => Vedeu::Colours::Background,
@@ -195,6 +195,14 @@ module Vedeu
195
195
  instance.options[:log_only] || []
196
196
  end
197
197
 
198
+ # Returns whether mouse support was enabled or disabled.
199
+ #
200
+ # @return [Boolean]
201
+ def mouse?
202
+ instance.options[:mouse]
203
+ end
204
+ alias_method :mouse, :mouse?
205
+
198
206
  # Returns whether the application will run through its main loop
199
207
  # once or not. Default is false; meaning the application will
200
208
  # loop forever or until terminated by the user.
@@ -336,6 +344,7 @@ module Vedeu
336
344
  interactive: true,
337
345
  log: nil,
338
346
  log_only: [],
347
+ mouse: true,
339
348
  once: false,
340
349
  profile: false,
341
350
  renderers: [Vedeu::Renderers::Terminal.new],
@@ -18,4 +18,5 @@ end # Vedeu
18
18
  require 'vedeu/cursors/cursor'
19
19
  require 'vedeu/cursors/dsl'
20
20
  require 'vedeu/cursors/refresh'
21
+ require 'vedeu/cursors/reposition'
21
22
  require 'vedeu/cursors/repository'
@@ -158,25 +158,11 @@ module Vedeu
158
158
  #
159
159
  # @return [Array<Vedeu::Models::Escape>]
160
160
  def render
161
- Vedeu.log(message: "Refreshing cursor: '#{name}'".freeze)
161
+ Vedeu.log(type: :output, message: "Refreshing cursor: '#{name}'".freeze)
162
162
 
163
163
  Vedeu.render_output(escape_sequence)
164
164
  end
165
165
 
166
- # Arbitrarily move the cursor to a given position.
167
- #
168
- # @param new_oy [Fixnum] The row/line position.
169
- # @param new_ox [Fixnum] The column/character position.
170
- # @return [Vedeu::Cursors::Cursor]
171
- def reposition(new_oy, new_ox)
172
- @oy = new_oy
173
- @ox = new_ox
174
- @y = coordinate(oy, :y).y
175
- @x = coordinate(ox, :x).x
176
-
177
- store
178
- end
179
-
180
166
  # @return [Array<Fixnum>]
181
167
  def to_a
182
168
  position.to_a
@@ -394,23 +380,37 @@ module Vedeu
394
380
 
395
381
  # See {file:docs/cursors.md}
396
382
  Vedeu.bind(:_cursor_reposition_) do |name, y, x|
397
- Vedeu.cursors.by_name(name).reposition(y, x)
398
-
399
- Vedeu.trigger(:_clear_view_, name)
400
- Vedeu.trigger(:_refresh_view_, name)
401
- Vedeu.trigger(:_refresh_cursor_, name)
383
+ Vedeu::Cursors::Reposition.new(name: name,
384
+ y: y,
385
+ x: x,
386
+ mode: :absolute).reposition
402
387
  end
403
388
 
404
389
  # See {file:docs/cursors.md}
405
390
  Vedeu.bind(:_cursor_top_) do |name|
406
- Vedeu.trigger(:_cursor_reposition_, name, 0, 0)
391
+ name ||= Vedeu.focus
392
+
393
+ Vedeu::Cursors::Reposition.new(name: name,
394
+ y: 0,
395
+ x: 0,
396
+ mode: :relative).reposition
397
+
398
+ Vedeu.trigger(:_clear_view_, name)
399
+ Vedeu.trigger(:_refresh_view_, name)
407
400
  end
408
401
 
409
402
  # See {file:docs/cursors.md}
410
403
  Vedeu.bind(:_cursor_bottom_) do |name|
404
+ name ||= Vedeu.focus
411
405
  count = Vedeu.buffers.by_name(name).size
412
406
 
413
- Vedeu.trigger(:_cursor_reposition_, name, count, 0)
407
+ Vedeu::Cursors::Reposition.new(name: name,
408
+ y: count,
409
+ x: 0,
410
+ mode: :relative).reposition
411
+
412
+ Vedeu.trigger(:_clear_view_, name)
413
+ Vedeu.trigger(:_refresh_view_, name)
414
414
  end
415
415
 
416
416
  # :nocov:
@@ -0,0 +1,143 @@
1
+ module Vedeu
2
+
3
+ module Cursors
4
+
5
+ # Arbitrarily move the cursor to a given position.
6
+ #
7
+ class Reposition
8
+
9
+ # Returns a new instance of Vedeu::Cursors::Reposition.
10
+ #
11
+ # @param attributes [Hash<Symbol => Fixnum|Symbol|String]
12
+ # @option attributes mode [Symbol] One of either :absolute or
13
+ # :relative. Relates to the coordinates provided.
14
+ # @option attributes name [String|Symbol] The name of the cursor
15
+ # and related interface/view.
16
+ # @option attributes x [Fixnum] The new row/line position.
17
+ # @option attributes y [Fixnum] The new column/character
18
+ # position.
19
+ # @return [Vedeu::Cursors::Reposition]
20
+ def initialize(attributes = {})
21
+ defaults.merge!(attributes).each do |key, value|
22
+ instance_variable_set("@#{key}", value)
23
+ end
24
+ end
25
+
26
+ # @return [Vedeu::Cursors::Cursor]
27
+ def reposition
28
+ cursor = Vedeu::Cursors::Cursor.store(new_attributes)
29
+
30
+ Vedeu.trigger(:_refresh_cursor_, name)
31
+
32
+ cursor
33
+ end
34
+
35
+ protected
36
+
37
+ # @!attribute [r] name
38
+ # @return [String|Symbol]
39
+ attr_reader :name
40
+
41
+ # @!attribute [r] x
42
+ # @return [Fixnum]
43
+ attr_reader :x
44
+
45
+ # @!attribute [r] y
46
+ # @return [Fixnum]
47
+ attr_reader :y
48
+
49
+ private
50
+
51
+ # @return [Boolean]
52
+ def absolute?
53
+ mode == :absolute
54
+ end
55
+
56
+ # Determine correct x and y related coordinates.
57
+ #
58
+ # @param offset []
59
+ # @param type []
60
+ # @return [Vedeu::Geometry::Coordinate]
61
+ def coordinate(offset, type)
62
+ Vedeu::Geometry::Coordinate.new(name: name, offset: offset, type: type)
63
+ end
64
+
65
+ # @return [Vedeu::Cursors::Cursor]
66
+ def cursor
67
+ Vedeu.cursors.by_name(name)
68
+ end
69
+
70
+ # @return [Hash<Symbol => Fixnum|Symbol|String]
71
+ def defaults
72
+ {
73
+ mode: :relative,
74
+ name: Vedeu.focus,
75
+ x: 0,
76
+ y: 0,
77
+ }
78
+ end
79
+
80
+ # @return [Vedeu::Geometry::Geometry]
81
+ def geometry
82
+ Vedeu.geometries.by_name(name)
83
+ end
84
+
85
+ # @return [Boolean]
86
+ def inside_geometry?
87
+ x >= geometry.x &&
88
+ x <= geometry.xn &&
89
+ y >= geometry.y &&
90
+ y <= geometry.yn
91
+ end
92
+
93
+ # @return [Symbol]
94
+ def mode
95
+ @mode = if modes.include?(@mode)
96
+ @mode
97
+
98
+ else
99
+ defaults[:mode]
100
+
101
+ end
102
+ end
103
+
104
+ # Positioning is handled either with absolute or relative
105
+ # coordinates, the coordinates are checked against the geometry
106
+ # of the interface/view and altered to reside within the
107
+ # boundary defined.
108
+ #
109
+ # @return [Array<Symbol>]
110
+ def modes
111
+ [:relative, :absolute]
112
+ end
113
+
114
+ # @return [Hash<Symbol => Fixnum>]
115
+ def new_attributes
116
+ if absolute? && inside_geometry?
117
+ cursor.attributes.merge!(x: coordinate((x - geometry.x), :x).x,
118
+ y: coordinate((y - geometry.y), :y).y,
119
+ ox: 0,
120
+ oy: 0)
121
+
122
+ elsif relative?
123
+ cursor.attributes.merge!(x: coordinate(x, :x).x,
124
+ y: coordinate(y, :y).y,
125
+ ox: x,
126
+ oy: y)
127
+
128
+ else
129
+ cursor.attributes
130
+
131
+ end
132
+ end
133
+
134
+ # @return [Boolean]
135
+ def relative?
136
+ mode == :relative
137
+ end
138
+
139
+ end # Reposition
140
+
141
+ end # Cursors
142
+
143
+ end # Vedeu
@@ -34,7 +34,7 @@ module Vedeu
34
34
  keys = console.getch
35
35
 
36
36
  if keys.ord == ESCAPE_KEY_CODE
37
- @chars = 3
37
+ @chars = 5
38
38
 
39
39
  begin
40
40
  keys << console.read_nonblock(@chars)
@@ -52,6 +52,24 @@ module Vedeu
52
52
  end
53
53
  end
54
54
 
55
+ if keys.start_with?("\e[M")
56
+ button, x, y = keys.chars[3..-1].map { |c| c.ord - 32 }
57
+
58
+ Vedeu.log(type: :input,
59
+ message: "Mouse pressed: '#{button}' (x: #{x}, y: #{y})")
60
+
61
+ if button == 0 # left mouse button
62
+ Vedeu.trigger(:_cursor_reposition_, Vedeu.focus, y, x)
63
+
64
+ elsif button == 64 # scroll wheel up
65
+ Vedeu.trigger(:_cursor_up_, Vedeu.focus)
66
+
67
+ elsif button == 65 # scroll wheel down
68
+ Vedeu.trigger(:_cursor_down_, Vedeu.focus)
69
+
70
+ end
71
+ end
72
+
55
73
  keys
56
74
  end
57
75
 
data/lib/vedeu/esc/all.rb CHANGED
@@ -11,4 +11,5 @@ end # Vedeu
11
11
  require 'vedeu/esc/actions'
12
12
  require 'vedeu/esc/borders'
13
13
  require 'vedeu/esc/colours'
14
+ require 'vedeu/esc/mouse'
14
15
  require 'vedeu/esc/esc'
data/lib/vedeu/esc/esc.rb CHANGED
@@ -15,6 +15,7 @@ module Vedeu
15
15
  include Vedeu::EscapeSequences::Actions
16
16
  include Vedeu::EscapeSequences::Borders
17
17
  include Vedeu::EscapeSequences::Colours
18
+ include Vedeu::EscapeSequences::Mouse
18
19
  extend self
19
20
 
20
21
  # Return the stream with the escape sequences escaped so that
@@ -73,6 +74,28 @@ module Vedeu
73
74
  Vedeu::Configuration.colour.to_s
74
75
  end
75
76
 
77
+ # @return [String]
78
+ def disable_mouse
79
+ if Vedeu::Configuration.mouse == true
80
+ "#{mouse_x10_off}".freeze
81
+
82
+ else
83
+ ''.freeze
84
+
85
+ end
86
+ end
87
+
88
+ # @return [String]
89
+ def enable_mouse
90
+ if Vedeu::Configuration.mouse == true
91
+ "#{mouse_x10_on}".freeze
92
+
93
+ else
94
+ ''.freeze
95
+
96
+ end
97
+ end
98
+
76
99
  # @return [String]
77
100
  def normal
78
101
  "#{underline_off}#{bold_off}#{positive}".freeze
@@ -80,7 +103,7 @@ module Vedeu
80
103
 
81
104
  # @return [String]
82
105
  def screen_init
83
- "#{reset}#{clear}#{hide_cursor}".freeze
106
+ "#{reset}#{clear}#{hide_cursor}#{enable_mouse}".freeze
84
107
  end
85
108
 
86
109
  # @return [String]
@@ -90,7 +113,7 @@ module Vedeu
90
113
 
91
114
  # @return [String]
92
115
  def screen_exit
93
- "#{show_cursor}#{screen_colour_reset}#{reset}" \
116
+ "#{disable_mouse}#{show_cursor}#{screen_colour_reset}#{reset}" \
94
117
  "#{last_character_position}\n".freeze
95
118
  end
96
119
 
@@ -0,0 +1,61 @@
1
+ module Vedeu
2
+
3
+ module EscapeSequences
4
+
5
+ # Provides mouse related escape sequences.
6
+ #
7
+ # The X10 compatibility mode sends an escape sequence on button
8
+ # press encoding the location and the mouse button pressed. It is
9
+ # enabled by sending `\e[?9h` and disabled with `\e[?9l`.
10
+ #
11
+ # On button press, xterm(1) sends `\e[Mbxy` (6 characters).
12
+ # Here b is button-1, and x and y are the x and y coordinates of
13
+ # the mouse when the button was pressed. This is the same code the
14
+ # kernel also produces.
15
+ #
16
+ # Normal tracking mode (not implemented in Linux 2.0.24) sends an
17
+ # escape sequence on both button press and release. Modifier
18
+ # information is also sent. It is enabled by sending `\e[?1000h`
19
+ # and disabled with `\e[?1000l`. On button press or release,
20
+ # xterm(1) sends `\e[Mbxy`. The low two bits of b encode button
21
+ # information: 0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed,
22
+ # 3=release. The upper bits encode what modifiers were down when
23
+ # the button was pressed and are added together: 4=Shift, 8=Meta,
24
+ # 16=Control. Again x and y are the x and y coordinates of the
25
+ # mouse event. The upper left corner is (1,1).
26
+ #
27
+ # - From CONSOLE_CODES(4) (`man console_codes`)
28
+ #
29
+ module Mouse
30
+
31
+ extend self
32
+
33
+ # @return [Hash<Symbol => String>]
34
+ def mouse_codes
35
+ {
36
+ mouse_x10_on: "\e[?9h".freeze,
37
+ mouse_x10_off: "\e[?9l".freeze,
38
+ mouse_on: "\e[?1000h".freeze,
39
+ mouse_off: "\e[?1000l".freeze,
40
+ }
41
+ end
42
+
43
+ # @return [void]
44
+ def setup!
45
+ define_actions!
46
+ end
47
+
48
+ private
49
+
50
+ # @return [void]
51
+ def define_actions!
52
+ mouse_codes.each { |key, code| define_method(key) { code } }
53
+ end
54
+
55
+ end # Mouse
56
+
57
+ end # EscapeSequences
58
+
59
+ Vedeu::EscapeSequences::Mouse.setup!
60
+
61
+ end # Vedeu
@@ -138,27 +138,28 @@ module Vedeu
138
138
  # @return [Hash<Symbol => Array<Symbol>>]
139
139
  def message_types
140
140
  {
141
- create: [:light_cyan, :cyan],
142
- store: [:light_cyan, :cyan],
143
- update: [:light_cyan, :cyan],
144
- reset: [:light_cyan, :cyan],
141
+ create: [:light_cyan, :cyan],
142
+ store: [:light_cyan, :cyan],
143
+ update: [:light_cyan, :cyan],
144
+ reset: [:light_cyan, :cyan],
145
145
 
146
146
  event: [:light_magenta, :magenta],
147
147
 
148
- timer: [:light_yellow, :yellow],
148
+ timer: [:light_blue, :blue],
149
149
 
150
- info: [:white, :default],
151
- test: [:white, :default],
152
- debug: [:white, :default],
150
+ info: [:white, :light_grey],
151
+ test: [:white, :light_grey],
152
+ debug: [:white, :light_grey],
153
153
 
154
- input: [:light_red, :red],
155
- output: [:light_red, :red],
156
- error: [:light_red, :red],
154
+ input: [:light_yellow, :yellow],
155
+ output: [:light_green, :green],
157
156
 
158
- config: [:light_blue, :blue],
159
- dsl: [:light_blue, :blue],
160
- editor: [:light_blue, :blue],
161
- drb: [:light_blue, :blue],
157
+ error: [:light_red, :red],
158
+
159
+ config: [:light_blue, :blue],
160
+ dsl: [:light_blue, :blue],
161
+ editor: [:light_blue, :blue],
162
+ drb: [:light_blue, :blue],
162
163
  }
163
164
  end
164
165
 
@@ -112,7 +112,7 @@ module Vedeu
112
112
  # @return [void]
113
113
  # @see Vedeu::Toggleable#show
114
114
  def show_cursor(name = Vedeu.focus)
115
- show(name) unless cursor_visible?(name)
115
+ show(name) if cursor_visible?(name)
116
116
  end
117
117
 
118
118
  # Toggle the cursor visibility.
data/lib/vedeu/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # The current version of Vedeu.
4
- VERSION = '0.6.49'.freeze
4
+ VERSION = '0.6.50'.freeze
5
5
 
6
6
  end
@@ -426,6 +426,30 @@ module Vedeu
426
426
  end
427
427
  end
428
428
 
429
+ describe '#mouse!' do
430
+ it { instance.must_respond_to(:mouse) }
431
+
432
+ it 'sets the option to the desired value' do
433
+ configuration = Vedeu.configure { mouse! }
434
+ configuration.mouse.must_equal(true)
435
+ end
436
+
437
+ it 'sets the option to the desired value' do
438
+ configuration = Vedeu.configure { mouse(false) }
439
+ configuration.mouse.must_equal(false)
440
+ end
441
+
442
+ it 'sets the option to the desired value' do
443
+ configuration = Vedeu.configure { mouse(true) }
444
+ configuration.mouse.must_equal(true)
445
+ end
446
+
447
+ it 'sets the option to the desired value' do
448
+ configuration = Vedeu.configure { mouse }
449
+ configuration.mouse.must_equal(true)
450
+ end
451
+ end
452
+
429
453
  end # API
430
454
 
431
455
  end # Config
@@ -109,6 +109,14 @@ module Vedeu
109
109
  end
110
110
  end
111
111
 
112
+ describe '.mouse?' do
113
+ it { described.must_respond_to(:mouse) }
114
+
115
+ it 'returns the value of the mouse option' do
116
+ described.mouse?.must_equal(true)
117
+ end
118
+ end
119
+
112
120
  describe '.once?' do
113
121
  it { described.must_respond_to(:once) }
114
122
 
@@ -257,20 +257,6 @@ module Vedeu
257
257
  it { subject.must_be_instance_of(Vedeu::Models::Escape) }
258
258
  end
259
259
 
260
- describe '#reposition' do
261
- let(:new_y) { 3 }
262
- let(:new_x) { 5 }
263
-
264
- subject { instance.reposition(new_y, new_x) }
265
-
266
- it { subject.must_be_instance_of(described) }
267
-
268
- it { subject.x.must_equal(10) }
269
- it { subject.y.must_equal(8) }
270
- it { subject.ox.must_equal(5) }
271
- it { subject.oy.must_equal(3) }
272
- end
273
-
274
260
  describe '#to_a' do
275
261
  subject { instance.to_a }
276
262
 
@@ -0,0 +1,100 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Cursors
6
+
7
+ describe Reposition do
8
+
9
+ let(:described) { Vedeu::Cursors::Reposition }
10
+ let(:instance) { described.new(attributes) }
11
+ let(:mode) {}
12
+ let(:_name) { :reposition_test }
13
+ let(:x) { 0 }
14
+ let(:y) { 0 }
15
+ let(:attributes) {
16
+ {
17
+ mode: mode,
18
+ name: _name,
19
+ x: x,
20
+ y: y,
21
+ }
22
+ }
23
+
24
+ before {
25
+ Vedeu.interface :reposition_test do
26
+ geometry do
27
+ x 4
28
+ y 4
29
+ xn 13
30
+ yn 9
31
+ end
32
+ end
33
+ Vedeu.stubs(:trigger).with(:_refresh_cursor_, _name)
34
+ }
35
+ after { Vedeu.interfaces.reset! }
36
+
37
+ describe '#initialize' do
38
+ it { instance.must_be_instance_of(described) }
39
+ it { instance.instance_variable_get('@mode').must_equal(mode) }
40
+ it { instance.instance_variable_get('@name').must_equal(_name) }
41
+ it { instance.instance_variable_get('@x').must_equal(x) }
42
+ it { instance.instance_variable_get('@y').must_equal(y) }
43
+ end
44
+
45
+ describe '#reposition' do
46
+ subject { instance.reposition }
47
+
48
+ it {
49
+ Vedeu.expects(:trigger).with(:_refresh_cursor_, _name)
50
+ subject
51
+ }
52
+
53
+ it { subject.must_be_instance_of(Vedeu::Cursors::Cursor) }
54
+
55
+ context 'when the mode is absolute' do
56
+ let(:mode) { :absolute }
57
+
58
+ context 'when inside the interface boundary' do
59
+ let(:x) { 11 }
60
+ let(:y) { 7 }
61
+
62
+ it { subject.x.must_equal(11) }
63
+ it { subject.y.must_equal(7) }
64
+ end
65
+
66
+ context 'when not inside the interface boundary' do
67
+ let(:x) { 15 }
68
+ let(:y) { 8 }
69
+
70
+ it { subject.x.must_equal(4) }
71
+ it { subject.y.must_equal(4) }
72
+ end
73
+ end
74
+
75
+ context 'when the mode is relative' do
76
+ let(:mode) { :relative }
77
+
78
+ context 'when inside the interface boundary' do
79
+ let(:x) { 7 }
80
+ let(:y) { 7 }
81
+
82
+ it { subject.x.must_equal(11) }
83
+ it { subject.y.must_equal(9) }
84
+ end
85
+
86
+ context 'when not inside the interface boundary' do
87
+ let(:x) { 2 }
88
+ let(:y) { 8 }
89
+
90
+ it { subject.x.must_equal(6) }
91
+ it { subject.y.must_equal(9) }
92
+ end
93
+ end
94
+ end
95
+
96
+ end # Reposition
97
+
98
+ end # Cursors
99
+
100
+ end # Vedeu
@@ -54,7 +54,7 @@ module Vedeu
54
54
  it { described.string('fg_reset').must_equal("\e[39m") }
55
55
  it { described.string('hide_cursor').must_equal("\e[?25l") }
56
56
  it { described.string('screen_init').
57
- must_equal("\e[0m\e[39m\e[49m\e[2J\e[?25l") }
57
+ must_equal("\e[0m\e[39m\e[49m\e[2J\e[?25l\e[?9h") }
58
58
  it { described.string('negative').must_equal("\e[7m") }
59
59
  it { described.string('positive').must_equal("\e[27m") }
60
60
  it { described.string('reset').must_equal("\e[0m") }
@@ -70,7 +70,7 @@ module Vedeu
70
70
  before { Vedeu::Terminal.stubs(:size).returns([80, 25]) }
71
71
 
72
72
  it { described.string('screen_exit').
73
- must_equal("\e[?25h\e[39m\e[49m\e[0m\e[80;25H\n") }
73
+ must_equal("\e[?9l\e[?25h\e[39m\e[49m\e[0m\e[80;25H\n") }
74
74
  end
75
75
  end
76
76
 
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module EscapeSequences
6
+
7
+ describe Mouse do
8
+
9
+ let(:described) { Vedeu::EscapeSequences::Mouse }
10
+
11
+ describe 'mouse methods' do
12
+ it { described.mouse_x10_on.must_equal("\e[?9h") }
13
+ it { described.mouse_x10_off.must_equal("\e[?9l") }
14
+ it { described.mouse_on.must_equal("\e[?1000h") }
15
+ it { described.mouse_off.must_equal("\e[?1000l") }
16
+ end
17
+
18
+ describe '.mouse_codes' do
19
+ it { described.mouse_codes.must_be_instance_of(Hash) }
20
+ end
21
+
22
+ end # Mouse
23
+
24
+ end # EscapeSequences
25
+
26
+ end # Vedeu
@@ -19,7 +19,7 @@ module Vedeu
19
19
  subject { described.log(message: _message, force: force, type: type) }
20
20
 
21
21
  it { subject.must_equal(
22
- "\e[97m[info] \e[39m\e[39mSome message...\e[39m"
22
+ "\e[97m[info] \e[39m\e[37mSome message...\e[39m"
23
23
  ) }
24
24
  end
25
25
 
@@ -44,7 +44,7 @@ module Vedeu
44
44
 
45
45
  it {
46
46
  capture_io { subject }.must_equal(
47
- ["", "\e[97m[debug] \e[39m\e[39mLogging to stderr...\e[39m\n"]
47
+ ["", "\e[97m[debug] \e[39m\e[37mLogging to stderr...\e[39m\n"]
48
48
  )
49
49
  }
50
50
  end
@@ -34,6 +34,7 @@ class VedeuMaterialColoursApp
34
34
  caption('Unicorns!')
35
35
  end
36
36
  colour foreground: '#ffffff', background: :default
37
+ cursor!
37
38
  geometry 'main_interface' do
38
39
  x 3
39
40
  xn 24
@@ -60,6 +61,7 @@ class VedeuMaterialColoursApp
60
61
  bottom_left('+')
61
62
  end
62
63
  colour(foreground: '#ffffff', background: :default)
64
+ cursor!
63
65
  geometry 'other_interface' do
64
66
  x(27)
65
67
  xn(47)
@@ -80,6 +82,7 @@ class VedeuMaterialColoursApp
80
82
  bottom_left('+')
81
83
  end
82
84
  colour(foreground: '#ffffff', background: :default)
85
+ cursor!
83
86
  geometry 'empty_interface' do
84
87
  x(50)
85
88
  xn(64)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.49
4
+ version: 0.6.50
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-07 00:00:00.000000000 Z
11
+ date: 2015-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -355,6 +355,7 @@ files:
355
355
  - lib/vedeu/cursors/cursor.rb
356
356
  - lib/vedeu/cursors/dsl.rb
357
357
  - lib/vedeu/cursors/refresh.rb
358
+ - lib/vedeu/cursors/reposition.rb
358
359
  - lib/vedeu/cursors/repository.rb
359
360
  - lib/vedeu/distributed/all.rb
360
361
  - lib/vedeu/distributed/client.rb
@@ -399,6 +400,7 @@ files:
399
400
  - lib/vedeu/esc/borders.rb
400
401
  - lib/vedeu/esc/colours.rb
401
402
  - lib/vedeu/esc/esc.rb
403
+ - lib/vedeu/esc/mouse.rb
402
404
  - lib/vedeu/events/aliases.rb
403
405
  - lib/vedeu/events/all.rb
404
406
  - lib/vedeu/events/collection.rb
@@ -547,6 +549,7 @@ files:
547
549
  - test/lib/vedeu/cursors/cursor_test.rb
548
550
  - test/lib/vedeu/cursors/dsl_test.rb
549
551
  - test/lib/vedeu/cursors/refresh_test.rb
552
+ - test/lib/vedeu/cursors/reposition_test.rb
550
553
  - test/lib/vedeu/cursors/repository_test.rb
551
554
  - test/lib/vedeu/distributed/client_test.rb
552
555
  - test/lib/vedeu/distributed/server_test.rb
@@ -578,6 +581,7 @@ files:
578
581
  - test/lib/vedeu/esc/borders_test.rb
579
582
  - test/lib/vedeu/esc/colours_test.rb
580
583
  - test/lib/vedeu/esc/esc_test.rb
584
+ - test/lib/vedeu/esc/mouse_test.rb
581
585
  - test/lib/vedeu/events/aliases_test.rb
582
586
  - test/lib/vedeu/events/collection_test.rb
583
587
  - test/lib/vedeu/events/event_test.rb
@@ -752,6 +756,7 @@ test_files:
752
756
  - test/lib/vedeu/cursors/cursor_test.rb
753
757
  - test/lib/vedeu/cursors/dsl_test.rb
754
758
  - test/lib/vedeu/cursors/refresh_test.rb
759
+ - test/lib/vedeu/cursors/reposition_test.rb
755
760
  - test/lib/vedeu/cursors/repository_test.rb
756
761
  - test/lib/vedeu/distributed/client_test.rb
757
762
  - test/lib/vedeu/distributed/server_test.rb
@@ -783,6 +788,7 @@ test_files:
783
788
  - test/lib/vedeu/esc/borders_test.rb
784
789
  - test/lib/vedeu/esc/colours_test.rb
785
790
  - test/lib/vedeu/esc/esc_test.rb
791
+ - test/lib/vedeu/esc/mouse_test.rb
786
792
  - test/lib/vedeu/events/aliases_test.rb
787
793
  - test/lib/vedeu/events/collection_test.rb
788
794
  - test/lib/vedeu/events/event_test.rb