vedeu 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/docs/dsl.md +4 -4
  4. data/lib/vedeu/all.rb +6 -18
  5. data/lib/vedeu/api.rb +14 -13
  6. data/lib/vedeu/bindings/system.rb +5 -4
  7. data/lib/vedeu/buffers/virtual_buffer.rb +13 -11
  8. data/lib/vedeu/configuration/api.rb +4 -3
  9. data/lib/vedeu/cursors/cursor.rb +23 -18
  10. data/lib/vedeu/distributed/client.rb +11 -6
  11. data/lib/vedeu/distributed/server.rb +4 -3
  12. data/lib/vedeu/dsl/keymap.rb +6 -6
  13. data/lib/vedeu/editor/all.rb +19 -0
  14. data/lib/vedeu/{input/editor → editor}/capture.rb +1 -1
  15. data/lib/vedeu/{input/editor → editor}/cropper.rb +0 -0
  16. data/lib/vedeu/{input/editor → editor}/cursor.rb +0 -0
  17. data/lib/vedeu/{input/editor → editor}/document.rb +0 -0
  18. data/lib/vedeu/{input/editor → editor}/documents.rb +0 -0
  19. data/lib/vedeu/{input/editor → editor}/editor.rb +0 -0
  20. data/lib/vedeu/{input/editor → editor}/insert.rb +0 -0
  21. data/lib/vedeu/{input/editor → editor}/line.rb +0 -0
  22. data/lib/vedeu/{input/editor → editor}/lines.rb +0 -0
  23. data/lib/vedeu/error.rb +21 -18
  24. data/lib/vedeu/esc/borders.rb +6 -4
  25. data/lib/vedeu/esc/colours.rb +13 -12
  26. data/lib/vedeu/esc/esc.rb +11 -10
  27. data/lib/vedeu/input/all.rb +15 -0
  28. data/lib/vedeu/input/input.rb +55 -52
  29. data/lib/vedeu/input/key.rb +36 -30
  30. data/lib/vedeu/input/keymap.rb +101 -92
  31. data/lib/vedeu/input/keymaps.rb +10 -6
  32. data/lib/vedeu/input/keys.rb +8 -4
  33. data/lib/vedeu/input/mapper.rb +125 -121
  34. data/lib/vedeu/input/translator.rb +159 -0
  35. data/lib/vedeu/internal_api.rb +16 -15
  36. data/lib/vedeu/logging/all.rb +13 -0
  37. data/lib/vedeu/logging/debug.rb +84 -0
  38. data/lib/vedeu/logging/lockless_log_device.rb +65 -0
  39. data/lib/vedeu/logging/log.rb +179 -0
  40. data/lib/vedeu/logging/mono_logger.rb +26 -0
  41. data/lib/vedeu/logging/timer.rb +68 -0
  42. data/lib/vedeu/menus/all.rb +12 -0
  43. data/lib/vedeu/{dsl/menu.rb → menus/dsl.rb} +19 -18
  44. data/lib/vedeu/menus/menu.rb +234 -0
  45. data/lib/vedeu/{null/menu.rb → menus/null.rb} +6 -6
  46. data/lib/vedeu/menus/repository.rb +18 -0
  47. data/lib/vedeu/models/cell.rb +62 -55
  48. data/lib/vedeu/models/escape.rb +55 -50
  49. data/lib/vedeu/models/page.rb +74 -69
  50. data/lib/vedeu/models/row.rb +55 -51
  51. data/lib/vedeu/models/views/all.rb +1 -0
  52. data/lib/vedeu/models/views/char.rb +1 -1
  53. data/lib/vedeu/models/views/html_char.rb +165 -0
  54. data/lib/vedeu/output/renderers/html.rb +5 -4
  55. data/lib/vedeu/repositories/model.rb +2 -0
  56. data/lib/vedeu/runtime/application.rb +110 -103
  57. data/lib/vedeu/runtime/bootstrap.rb +109 -103
  58. data/lib/vedeu/runtime/flags.rb +45 -41
  59. data/lib/vedeu/runtime/launcher.rb +1 -1
  60. data/lib/vedeu/runtime/main_loop.rb +51 -46
  61. data/lib/vedeu/runtime/traps.rb +20 -16
  62. data/lib/vedeu/version.rb +1 -1
  63. data/lib/vedeu.rb +2 -2
  64. data/test/lib/vedeu/buffers/virtual_buffer_test.rb +1 -1
  65. data/test/lib/vedeu/cursors/cursor_test.rb +11 -5
  66. data/test/lib/vedeu/dsl/interface_test.rb +1 -1
  67. data/test/lib/vedeu/dsl/keymap_test.rb +2 -2
  68. data/test/lib/vedeu/{input/editor → editor}/capture_test.rb +0 -0
  69. data/test/lib/vedeu/{input/editor → editor}/cropper_test.rb +0 -0
  70. data/test/lib/vedeu/{input/editor → editor}/cursor_test.rb +0 -0
  71. data/test/lib/vedeu/{input/editor → editor}/document_test.rb +0 -0
  72. data/test/lib/vedeu/{input/editor → editor}/documents_test.rb +0 -0
  73. data/test/lib/vedeu/{input/editor → editor}/editor_test.rb +0 -0
  74. data/test/lib/vedeu/{input/editor → editor}/insert_test.rb +0 -0
  75. data/test/lib/vedeu/{input/editor → editor}/line_test.rb +0 -0
  76. data/test/lib/vedeu/{input/editor → editor}/lines_test.rb +0 -0
  77. data/test/lib/vedeu/input/input_test.rb +58 -54
  78. data/test/lib/vedeu/input/key_test.rb +29 -25
  79. data/test/lib/vedeu/input/keymap_test.rb +74 -70
  80. data/test/lib/vedeu/input/keymaps_test.rb +8 -4
  81. data/test/lib/vedeu/input/keys_test.rb +12 -8
  82. data/test/lib/vedeu/input/mapper_test.rb +64 -56
  83. data/test/lib/vedeu/input/translator_test.rb +36 -0
  84. data/test/lib/vedeu/logging/debug_test.rb +39 -0
  85. data/test/lib/vedeu/logging/lockless_log_device_test.rb +42 -0
  86. data/test/lib/vedeu/logging/log_test.rb +52 -0
  87. data/test/lib/vedeu/logging/mono_logger_test.rb +43 -0
  88. data/test/lib/vedeu/logging/timer_test.rb +44 -0
  89. data/test/lib/vedeu/{dsl/menu_test.rb → menus/dsl_test.rb} +6 -6
  90. data/test/lib/vedeu/menus/menu_test.rb +305 -0
  91. data/test/lib/vedeu/{null/menu_test.rb → menus/null_test.rb} +5 -5
  92. data/test/lib/vedeu/menus/repository_test.rb +17 -0
  93. data/test/lib/vedeu/models/cell_test.rb +54 -50
  94. data/test/lib/vedeu/models/escape_test.rb +49 -45
  95. data/test/lib/vedeu/models/page_test.rb +167 -160
  96. data/test/lib/vedeu/models/row_test.rb +71 -67
  97. data/test/lib/vedeu/models/views/html_char_test.rb +110 -0
  98. data/test/lib/vedeu/output/compressor_test.rb +44 -22
  99. data/test/lib/vedeu/output/renderers_test.rb +4 -2
  100. data/test/lib/vedeu/runtime/application_test.rb +36 -32
  101. data/test/lib/vedeu/runtime/bootstrap_test.rb +31 -26
  102. data/test/lib/vedeu/runtime/flags_test.rb +33 -29
  103. data/test/lib/vedeu/runtime/launcher_test.rb +4 -2
  104. data/test/lib/vedeu/runtime/main_loop_test.rb +28 -24
  105. data/test/lib/vedeu/runtime/traps_test.rb +8 -4
  106. data/test/test_helper.rb +4 -2
  107. metadata +66 -63
  108. data/lib/vedeu/input/editor/all.rb +0 -19
  109. data/lib/vedeu/input/input_translator.rb +0 -155
  110. data/lib/vedeu/log/debug.rb +0 -79
  111. data/lib/vedeu/log/lockless_log_device.rb +0 -61
  112. data/lib/vedeu/log/log.rb +0 -172
  113. data/lib/vedeu/log/mono_logger.rb +0 -21
  114. data/lib/vedeu/log/timer.rb +0 -63
  115. data/lib/vedeu/models/menu.rb +0 -217
  116. data/lib/vedeu/models/menus.rb +0 -14
  117. data/lib/vedeu/output/html_char.rb +0 -161
  118. data/test/lib/vedeu/input/input_translator_test.rb +0 -32
  119. data/test/lib/vedeu/log/debug_test.rb +0 -35
  120. data/test/lib/vedeu/log/lockless_log_device_test.rb +0 -29
  121. data/test/lib/vedeu/log/log_test.rb +0 -48
  122. data/test/lib/vedeu/log/mono_logger_test.rb +0 -31
  123. data/test/lib/vedeu/log/timer_test.rb +0 -40
  124. data/test/lib/vedeu/models/menu_test.rb +0 -301
  125. data/test/lib/vedeu/models/menus_test.rb +0 -13
  126. data/test/lib/vedeu/output/html_char_test.rb +0 -106
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8361e0f679e7a752058e9a18febf179a3866dcb
4
- data.tar.gz: 48b0d34dc40c43fad42cc60c9c768716fea5fc55
3
+ metadata.gz: 43c20341c0356017348e3f761aa1b1371b5d5d53
4
+ data.tar.gz: bc914cbb3ca7912bc37b6d519edd74caafc71945
5
5
  SHA512:
6
- metadata.gz: 78eaf93359ac8620f7039ef9f15aef044c6023e1cb71baff51809bd0d70bea21665223f43a810d061cbe42d72059bc325d999890ce407a6ae432007b67a810e0
7
- data.tar.gz: ecdaafd1a7c70f86d9bf4ce2358135646b2692974b4de25a683b57c8771c218f0cb50942d9eec6e15adfa7ce1ddd83b6047563c0daf269cd46ceb39c74e4f8a4
6
+ metadata.gz: bc099e2bab2c7849429e57de5de0549889195bfc19833ee93644a45d609e8426cae6289c3df6e97846fe8d4a2eaecf3219ff4d1d32688387e69c4c2bf76e68af
7
+ data.tar.gz: 2c28487ea4337f6887775d6eeedf9d77f70766a3e7db89e915f9e61577c7b9103574cf537536b1fac39b0b1ca9762832282fc06de0ed775bae0f6ea868ae410a
data/LICENSE.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  Copyright (c) 2014 Gavin Laking
2
2
  Copyright (c) 2013 Steve Klabnik - Monologger
3
3
  (https://github.com/steveklabnik/mono_logger)
4
- Note: Code used inline in Vedeu::Log.
4
+ Note: Code used inline in Vedeu::Logging::Log.
5
5
  Copyright (c) 2013 Michael Grosser - Ruco
6
6
  (https://github.com/grosser/ruco)
7
7
  Note: Code from ruco's Window class was used as basis of
data/docs/dsl.md CHANGED
@@ -134,10 +134,10 @@ end
134
134
 
135
135
  ## Menus
136
136
 
137
- {include:Vedeu::DSL::Menu}
138
- {include:Vedeu::DSL::Menu#item}
139
- {include:Vedeu::DSL::Menu#items}
140
- {include:Vedeu::DSL::Menu#name}
137
+ {include:Vedeu::Menus::DSL}
138
+ {include:Vedeu::Menus::DSL#item}
139
+ {include:Vedeu::Menus::DSL#items}
140
+ {include:Vedeu::Menus::DSL#name}
141
141
 
142
142
  ## Views
143
143
 
data/lib/vedeu/all.rb CHANGED
@@ -4,11 +4,9 @@ require 'vedeu/options'
4
4
  require 'vedeu/runtime/launcher'
5
5
  require 'vedeu/runtime/bootstrap'
6
6
  require 'vedeu/error'
7
- require 'vedeu/log/lockless_log_device'
8
- require 'vedeu/log/mono_logger'
9
- require 'vedeu/log/log'
10
- require 'vedeu/log/debug'
11
- require 'vedeu/log/timer'
7
+
8
+ require 'vedeu/logging/all'
9
+
12
10
  require 'vedeu/runtime/traps'
13
11
  require 'vedeu/common'
14
12
  require 'vedeu/runtime/router'
@@ -37,7 +35,6 @@ require 'vedeu/repositories/repository'
37
35
  require 'vedeu/null/null'
38
36
  require 'vedeu/null/generic'
39
37
  require 'vedeu/null/interface'
40
- require 'vedeu/null/menu'
41
38
  require 'vedeu/null/view'
42
39
 
43
40
  require 'vedeu/refresh/refresh'
@@ -57,8 +54,6 @@ require 'vedeu/models/escape'
57
54
  require 'vedeu/models/focus'
58
55
  require 'vedeu/models/group'
59
56
  require 'vedeu/models/groups'
60
- require 'vedeu/models/menu'
61
- require 'vedeu/models/menus'
62
57
  require 'vedeu/models/row'
63
58
  require 'vedeu/models/page'
64
59
 
@@ -92,24 +87,18 @@ require 'vedeu/dsl/keymap'
92
87
  require 'vedeu/dsl/text'
93
88
  require 'vedeu/dsl/interface'
94
89
  require 'vedeu/dsl/line'
95
- require 'vedeu/dsl/menu'
96
90
  require 'vedeu/dsl/stream'
97
91
  require 'vedeu/dsl/view'
98
92
 
99
- require 'vedeu/input/input_translator'
100
- require 'vedeu/input/mapper'
101
- require 'vedeu/input/key'
102
- require 'vedeu/input/input'
103
- require 'vedeu/input/keymap'
104
- require 'vedeu/input/keymaps'
105
- require 'vedeu/input/editor/all'
106
-
107
93
  require 'vedeu/borders/all'
108
94
  require 'vedeu/buffers/all'
109
95
  require 'vedeu/colours/all'
110
96
  require 'vedeu/cursors/all'
97
+ require 'vedeu/editor/all'
111
98
  require 'vedeu/events/all'
112
99
  require 'vedeu/geometry/all'
100
+ require 'vedeu/input/all'
101
+ require 'vedeu/menus/all'
113
102
 
114
103
  require 'vedeu/output/direct'
115
104
  require 'vedeu/output/clear/named_group'
@@ -118,7 +107,6 @@ require 'vedeu/output/presentation'
118
107
  require 'vedeu/output/compressor'
119
108
  require 'vedeu/output/style'
120
109
  require 'vedeu/output/text'
121
- require 'vedeu/output/html_char'
122
110
  require 'vedeu/output/output'
123
111
  require 'vedeu/output/viewport'
124
112
  require 'vedeu/output/wordwrap'
data/lib/vedeu/api.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  module Vedeu
2
2
 
3
- # Provides the API to Vedeu. Methods therein, and classes belonging to this
4
- # module expose Vedeu's core functionality.
3
+ # Provides the API to Vedeu. Methods therein, and classes belonging
4
+ # to this module expose Vedeu's core functionality.
5
5
  #
6
- # These methods are used in a variety of ways, sometimes in combination:
6
+ # These methods are used in a variety of ways, sometimes in
7
+ # combination:
7
8
  #
8
9
  # # with parameters
9
10
  # Vedeu.method_name(*params)
@@ -99,20 +100,20 @@ module Vedeu
99
100
  :focus_next, :focus_previous
100
101
 
101
102
  # @!method log
102
- # @see Vedeu::Log.log
103
+ # @see Vedeu::Logging::Log.log
103
104
  # @!method log_stdout
104
- # @see Vedeu::Log.log_stdout
105
+ # @see Vedeu::Logging::Log.log_stdout
105
106
  # @!method log_stderr
106
- # @see Vedeu::Log.log_stderr
107
- def_delegators Vedeu::Log, :log, :log_stdout, :log_stderr
107
+ # @see Vedeu::Logging::Log.log_stderr
108
+ def_delegators Vedeu::Logging::Log, :log, :log_stdout, :log_stderr
108
109
 
109
110
  # @!method keypress
110
- # @see Vedeu::Mapper.keypress
111
- def_delegators Vedeu::Mapper, :keypress
111
+ # @see Vedeu::Input::Mapper.keypress
112
+ def_delegators Vedeu::Input::Mapper, :keypress
112
113
 
113
114
  # @!method menu
114
- # @see Vedeu::Menu.menu
115
- def_delegators Vedeu::Menu, :menu
115
+ # @see Vedeu::Menus::Menu.menu
116
+ def_delegators Vedeu::Menus::Menu, :menu
116
117
 
117
118
  # @!method goto
118
119
  # @see Vedeu::Router#goto
@@ -131,8 +132,8 @@ module Vedeu
131
132
  def_delegators Vedeu::Events::Trigger, :trigger
132
133
 
133
134
  # @!method exit
134
- # @see Vedeu::Application.stop
135
- def_delegators Vedeu::Application, :exit
135
+ # @see Vedeu::Runtime::Application.stop
136
+ def_delegators Vedeu::Runtime::Application, :exit
136
137
 
137
138
  # @!method clear
138
139
  # @see Vedeu::Terminal#clear
@@ -77,8 +77,9 @@ module Vedeu
77
77
  Vedeu.bind(:_command_) { |command| Vedeu.trigger(:command, command) }
78
78
  end
79
79
 
80
- # This event is called by {Vedeu::Input#capture}. When invoked, the
81
- # key will be passed to the editor for currently focussed view.
80
+ # This event is called by {Vedeu::Input::Input#capture}. When
81
+ # invoked, the key will be passed to the editor for currently
82
+ # focussed view.
82
83
  #
83
84
  # @example
84
85
  # Vedeu.trigger(:_editor_, key)
@@ -99,7 +100,7 @@ module Vedeu
99
100
  #
100
101
  # @return [TrueClass]
101
102
  def exit!
102
- Vedeu.bind(:_exit_) { Vedeu::Application.stop }
103
+ Vedeu.bind(:_exit_) { Vedeu::Runtime::Application.stop }
103
104
  end
104
105
 
105
106
  # Vedeu triggers this event when it is ready to enter the main loop.
@@ -119,7 +120,7 @@ module Vedeu
119
120
  # with the argument `:escape`, also an internal event `_mode_switch_` is
120
121
  # triggered. Vedeu recognises most key presses and some 'extended'
121
122
  # keypress (eg. Ctrl+J), a list of supported keypresses can be found here:
122
- # {Vedeu::Input#specials} and {Vedeu::Input#f_keys}.
123
+ # {Vedeu::Input::Input#specials} and {Vedeu::Input::Input#f_keys}.
123
124
  #
124
125
  # @example
125
126
  # Vedeu.trigger(:_keypress_, key)
@@ -1,6 +1,7 @@
1
1
  module Vedeu
2
2
 
3
- # Represents a {Vedeu::Terminal} view as a grid of {Vedeu::Cell} objects.
3
+ # Represents a {Vedeu::Terminal} view as a grid of
4
+ # {Vedeu::Models::Cell} objects.
4
5
  #
5
6
  class VirtualBuffer
6
7
 
@@ -27,8 +28,8 @@ module Vedeu
27
28
  #
28
29
  # @param height [Fixnum]
29
30
  # @param width [Fixnum]
30
- # @param renderer [Object|Vedeu::Renderers::HTML] An object responding to
31
- # .render.
31
+ # @param renderer [Object|Vedeu::Renderers::HTML] An object
32
+ # responding to .render.
32
33
  # @return [Vedeu::VirtualBuffer]
33
34
  def initialize(height, width, renderer = Vedeu::Renderers::HTML.new)
34
35
  @height = height
@@ -36,8 +37,8 @@ module Vedeu
36
37
  @renderer = renderer
37
38
  end
38
39
 
39
- # Return a grid of {Vedeu::Views::Char} objects defined by the height and
40
- # width of this virtual terminal.
40
+ # Return a grid of {Vedeu::Views::Char} objects defined by the
41
+ # height and width of this virtual terminal.
41
42
  #
42
43
  # @return [Array<Array<Vedeu::Views::Char>>]
43
44
  def cells
@@ -82,7 +83,8 @@ module Vedeu
82
83
  renderer.render(cells)
83
84
  end
84
85
 
85
- # Removes all content from the virtual terminal; effectively clearing it.
86
+ # Removes all content from the virtual terminal; effectively
87
+ # clearing it.
86
88
  #
87
89
  # @return [Array<Array<Vedeu::Views::Char>>]
88
90
  def reset
@@ -101,7 +103,7 @@ module Vedeu
101
103
  # @param data [Vedeu::Views::Char]
102
104
  # @return [Vedeu::Views::Char]
103
105
  def write(y, x, data)
104
- return false unless read(y, x).is_a?(Vedeu::Cell)
106
+ return false unless read(y, x).is_a?(Vedeu::Models::Cell)
105
107
 
106
108
  cy, cx = Vedeu::Geometry::Position[y, x].as_indices
107
109
  cells[cy][cx] = data
@@ -112,17 +114,17 @@ module Vedeu
112
114
  private
113
115
 
114
116
  # @param from [Array] An Array of rows, or an Array of cells.
115
- # @param which [Fixnum] A Fixnum representing the index; the row number or
116
- # the cell number for a row.
117
+ # @param which [Fixnum] A Fixnum representing the index; the row
118
+ # number or the cell number for a row.
117
119
  # @return [Array<Vedeu::Views::Char>|Array]
118
120
  def fetch(from, which)
119
121
  from[which] || []
120
122
  end
121
123
 
122
- # @return [Array<Array<Vedeu::Cell>>]
124
+ # @return [Array<Array<Vedeu::Models::Cell>>]
123
125
  # @see Vedeu::VirtualBuffer#cells
124
126
  def new_virtual_buffer
125
- Array.new(height) { Array.new(width) { Vedeu::Cell.new } }
127
+ Array.new(height) { Array.new(width) { Vedeu::Models::Cell.new } }
126
128
  end
127
129
 
128
130
  end # VirtualBuffer
@@ -275,15 +275,16 @@ module Vedeu
275
275
  options[:log] = filename
276
276
  end
277
277
 
278
- # Only log specific message types. A complete list of message types can
279
- # be found at {Vedeu::Log.message_types}.
278
+ # Only log specific message types. A complete list of message
279
+ # types can be found at {Vedeu::Logging::Log.message_types}.
280
280
  #
281
281
  # Vedeu.configure do
282
282
  # log_only :debug, :event
283
283
  # # ...
284
284
  # end
285
285
  #
286
- # @param types [Array<Symbol>] The message types which should be logged.
286
+ # @param types [Array<Symbol>] The message types which should be
287
+ # slogged.
287
288
  # @return [Array<Symbol>]
288
289
  def log_only(*types)
289
290
  options[:log_only] = types
@@ -2,8 +2,8 @@ module Vedeu
2
2
 
3
3
  module Cursors
4
4
 
5
- # Each interface has its own Cursor which maintains the position and
6
- # visibility of the cursor within that interface.
5
+ # Each interface has its own Cursor which maintains the position
6
+ # and visibility of the cursor within that interface.
7
7
  #
8
8
  class Cursor
9
9
 
@@ -48,14 +48,17 @@ module Vedeu
48
48
  # Returns a new instance of Vedeu::Cursors::Cursor.
49
49
  #
50
50
  # @param attributes [Hash]
51
- # @option attributes name [String] The name of the interface this cursor
52
- # belongs to.
51
+ # @option attributes name [String] The name of the interface
52
+ # this cursor belongs to.
53
53
  # @option attributes ox [Fixnum] The offset x coordinate.
54
54
  # @option attributes oy [Fixnum] The offset y coordinate.
55
55
  # @option attributes repository [Vedeu::Repository]
56
- # @option attributes visible [Boolean] The visibility of the cursor.
57
- # @option attributes x [Fixnum] The terminal x coordinate for the cursor.
58
- # @option attributes y [Fixnum] The terminal y coordinate for the cursor.
56
+ # @option attributes visible [Boolean] The visibility of the
57
+ # cursor.
58
+ # @option attributes x [Fixnum] The terminal x coordinate for
59
+ # the cursor.
60
+ # @option attributes y [Fixnum] The terminal y coordinate for
61
+ # the cursor.
59
62
  #
60
63
  # @return [Vedeu::Cursors::Cursor]
61
64
  def initialize(attributes = {})
@@ -133,7 +136,7 @@ module Vedeu
133
136
 
134
137
  # Renders the cursor.
135
138
  #
136
- # @return [Array<Vedeu::Escape>]
139
+ # @return [Array<Vedeu::Models::Escape>]
137
140
  def render
138
141
  Vedeu::Output.render(visibility)
139
142
  end
@@ -153,8 +156,8 @@ module Vedeu
153
156
  end
154
157
 
155
158
  # Returns an escape sequence to position the cursor and set its
156
- # visibility. When passed a block, will position the cursor, yield and
157
- # return the original position.
159
+ # visibility. When passed a block, will position the cursor,
160
+ # yield and return the original position.
158
161
  #
159
162
  # @return [String]
160
163
  def to_s
@@ -168,13 +171,14 @@ module Vedeu
168
171
  end
169
172
  alias_method :to_str, :to_s
170
173
 
171
- # Hide a named cursor, or without a name, the cursor of the currently
174
+ # Hide a named cursor, or without a name, the cursor of the
175
+ # currently
172
176
  # focussed interface.
173
177
  #
174
178
  # @example
175
179
  # Vedeu.hide_cursor(name)
176
180
  #
177
- # @return [Vedeu::Escape]
181
+ # @return [Vedeu::Models::Escape]
178
182
  def hide
179
183
  super
180
184
 
@@ -200,13 +204,13 @@ module Vedeu
200
204
  @position = Vedeu::Geometry::Position[y, x]
201
205
  end
202
206
 
203
- # Show a named cursor, or without a name, the cursor of the currently
204
- # focussed interface.
207
+ # Show a named cursor, or without a name, the cursor of the
208
+ # currently focussed interface.
205
209
  #
206
210
  # @example
207
211
  # Vedeu.show_cursor(name)
208
212
  #
209
- # @return [Vedeu::Escape]
213
+ # @return [Vedeu::Models::Escape]
210
214
  def show
211
215
  super
212
216
 
@@ -218,7 +222,7 @@ module Vedeu
218
222
  # @example
219
223
  # Vedeu.toggle_cursor(name)
220
224
  #
221
- # @return [Vedeu::Escape]
225
+ # @return [Vedeu::Models::Escape]
222
226
  def toggle
223
227
  if visible?
224
228
  hide
@@ -276,13 +280,14 @@ module Vedeu
276
280
  }
277
281
  end
278
282
 
279
- # Returns the escape sequence for setting the visibility of the cursor.
283
+ # Returns the escape sequence for setting the visibility of the
284
+ # cursor.
280
285
  #
281
286
  # @return [String]
282
287
  def visibility
283
288
  value = visible? ? Vedeu::Esc.show_cursor : Vedeu::Esc.hide_cursor
284
289
 
285
- Vedeu::Escape.new(position: position, value: value)
290
+ Vedeu::Models::Escape.new(position: position, value: value)
286
291
  end
287
292
 
288
293
  end # Cursor
@@ -1,13 +1,16 @@
1
1
  module Vedeu
2
2
 
3
- # Provides a mechanism to control a running client application via DRb.
3
+ # Provides a mechanism to control a running client application via
4
+ # DRb.
4
5
  #
5
6
  module Distributed
6
7
 
7
- # A class for the client side of the DRb server/client relationship.
8
+ # A class for the client side of the DRb server/client
9
+ # relationship.
8
10
  #
9
11
  # @example
10
- # client = Vedeu::Distributed::Client.connect("druby://localhost:21420")
12
+ # client = Vedeu::Distributed::Client.
13
+ # connect("druby://localhost:21420")
11
14
  # client.input('a')
12
15
  # client.output # => 'some content...'
13
16
  class Client
@@ -25,7 +28,8 @@ module Vedeu
25
28
  @uri = uri.to_s
26
29
  end
27
30
 
28
- # Simulate connecting to the DRb server by requesting its status.
31
+ # Simulate connecting to the DRb server by requesting its
32
+ # status.
29
33
  #
30
34
  # @return [Symbol]
31
35
  def connect
@@ -67,8 +71,9 @@ module Vedeu
67
71
  # Shutdown the DRb server and the client application.
68
72
  #
69
73
  # @note
70
- # {Vedeu::Application} will raise StopIteration when its `.stop` method
71
- # is called. Here we rescue that to give a clean client exit.
74
+ # {Vedeu::Runtime::Application} will raise StopIteration when
75
+ # its `.stop` method is called. Here we rescue that to give a
76
+ # clean client exit.
72
77
  #
73
78
  # @return [void|Symbol]
74
79
  def shutdown
@@ -62,9 +62,10 @@ module Vedeu
62
62
  end # Eigenclass
63
63
 
64
64
  # @param data [String|Symbol] The input to send to Vedeu.
65
- # @param type [Symbol] Either :command or :keypress. Will trigger the
66
- # respective capture mode within {Vedeu::Input}, or if not given, will
67
- # treat the data as a keypress.
65
+ # @param type [Symbol] Either :command or :keypress. Will
66
+ # trigger the respective capture mode within
67
+ # {Vedeu::Input::Input}, or if not given, will treat the data
68
+ # as a keypress.
68
69
  # @return [void]
69
70
  def input(data, type = :keypress)
70
71
  Vedeu.trigger(:_drb_input_, data, type)
@@ -48,18 +48,18 @@ module Vedeu
48
48
  # to.
49
49
  # @param block [Proc]
50
50
  # @raise [Vedeu::Error::InvalidSyntax] The required block was not given.
51
- # @return [Vedeu::Keymap]
51
+ # @return [Vedeu::Input::Keymap]
52
52
  # @todo Try to remember why we need to pre-create the keymap in the
53
53
  # repository.
54
54
  def self.keymap(name, &block)
55
- Vedeu::Keymap.new(name: name).store
55
+ Vedeu::Input::Keymap.new(name: name).store
56
56
 
57
- Vedeu::Keymap.build(name: name, &block).store
57
+ Vedeu::Input::Keymap.build(name: name, &block).store
58
58
  end
59
59
 
60
60
  # Returns an instance of DSL::Keymap.
61
61
  #
62
- # @param model [Vedeu::Keymap]
62
+ # @param model [Vedeu::Input::Keymap]
63
63
  # @param client [Object]
64
64
  # @return [Vedeu::DSL::Keymap]
65
65
  def initialize(model, client = nil)
@@ -71,8 +71,8 @@ module Vedeu
71
71
  #
72
72
  # @param value_or_values [Array<String>|Array<Symbol>|String|Symbol]
73
73
  # The key(s) pressed. Special keys can be found in
74
- # {Vedeu::Input#specials}. When more than one key is defined, then the
75
- # extras are treated as aliases.
74
+ # {Vedeu::Input::Input#specials}. When more than one key is
75
+ # defined, then the extras are treated as aliases.
76
76
  # @param block [Proc] The action to perform when this key is pressed. Can
77
77
  # be a method call or event triggered.
78
78
  # @raise [Vedeu::Error::InvalidSyntax]
@@ -0,0 +1,19 @@
1
+ module Vedeu
2
+
3
+ # Provide a mechanism to edit individual lines of the view.
4
+ #
5
+ module Editor
6
+
7
+ end # Editor
8
+
9
+ end # Vedeu
10
+
11
+ require 'vedeu/editor/capture'
12
+ require 'vedeu/editor/cropper'
13
+ require 'vedeu/editor/editor'
14
+ require 'vedeu/editor/insert'
15
+ require 'vedeu/editor/line'
16
+ require 'vedeu/editor/lines'
17
+ require 'vedeu/editor/cursor'
18
+ require 'vedeu/editor/document'
19
+ require 'vedeu/editor/documents'
@@ -24,7 +24,7 @@ module Vedeu
24
24
 
25
25
  # @return [String|Symbol]
26
26
  def read
27
- Vedeu::InputTranslator.translate(keys)
27
+ Vedeu::Input::Translator.translate(keys)
28
28
  end
29
29
 
30
30
  private
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/lib/vedeu/error.rb CHANGED
@@ -1,18 +1,19 @@
1
1
  module Vedeu
2
2
 
3
- # Custom exceptions/errors which Vedeu will raise in certain circumstances.
3
+ # Custom exceptions/errors which Vedeu will raise in certain
4
+ # circumstances.
4
5
  #
5
6
  module Error
6
7
 
7
- # Raised with Vedeu attempts to access a client application controller's
8
- # action that does not exist.
8
+ # Raised with Vedeu attempts to access a client application
9
+ # controller's action that does not exist.
9
10
  #
10
11
  class ActionNotFound < StandardError
11
12
 
12
13
  end # ActionNotFound
13
14
 
14
- # Raised with Vedeu attempts to access a client application controller that
15
- # does not exist.
15
+ # Raised with Vedeu attempts to access a client application
16
+ # controller that does not exist.
16
17
  #
17
18
  class ControllerNotFound < StandardError
18
19
 
@@ -26,43 +27,44 @@ module Vedeu
26
27
 
27
28
  # Raised when Vedeu wishes to exit.
28
29
  #
29
- # @see Vedeu::MainLoop
30
+ # @see Vedeu::Runtime::MainLoop
30
31
  #
31
32
  class Interrupt < StandardError
32
33
 
33
34
  end # Interrupt
34
35
 
35
- # Raised when Vedeu attempts to parse a view or interface and encounters a
36
- # problem.
36
+ # Raised when Vedeu attempts to parse a view or interface and
37
+ # encounters a problem.
37
38
  #
38
39
  class InvalidSyntax < StandardError
39
40
 
40
41
  end # InvalidSyntax
41
42
 
42
- # Raised when a name is not provided for a model when attempting to store it
43
- # in a repository.
43
+ # Raised when a name is not provided for a model when attempting
44
+ # to store it in a repository.
44
45
  #
45
46
  class MissingRequired < StandardError
46
47
 
47
48
  end # MissingRequired
48
49
 
49
- # Raised with Vedeu attempts to access a named model that does not exist.
50
+ # Raised with Vedeu attempts to access a named model that does not
51
+ # exist.
50
52
  #
51
53
  class ModelNotFound < StandardError
52
54
 
53
55
  end # ModelNotFound
54
56
 
55
- # Raised intentionally when the client application wishes to switch between
56
- # cooked, fake and raw terminal modes.
57
+ # Raised intentionally when the client application wishes to
58
+ # switch between cooked, fake and raw terminal modes.
57
59
  #
58
- # @see Vedeu::Application
60
+ # @see Vedeu::Runtime::Application
59
61
  #
60
62
  class ModeSwitch < StandardError
61
63
 
62
64
  end # ModeSwitch
63
65
 
64
- # Raised to remind me (or client application developers) that the subclass
65
- # implements the functionality sought.
66
+ # Raised to remind me (or client application developers) that the
67
+ # subclass implements the functionality sought.
66
68
  #
67
69
  # @see Vedeu::Colours::Translator
68
70
  #
@@ -70,8 +72,9 @@ module Vedeu
70
72
 
71
73
  end # NotImplemented
72
74
 
73
- # Raised when trying to access an interface column less than 1 or greater
74
- # than 12. Vedeu is hard-wired to a 12-column layout for the time being.
75
+ # Raised when trying to access an interface column less than 1 or
76
+ # greater than 12. Vedeu is hard-wired to a 12-column layout for
77
+ # the time being.
75
78
  #
76
79
  # @see Vedeu::Geometry::Grid
77
80
  #
@@ -7,11 +7,13 @@ module Vedeu
7
7
  # Provides border/box related escape sequences.
8
8
  #
9
9
  # @note
10
- # Refer to UTF-8 U+2500 to U+257F for border characters. More details can
11
- # be found at: http://en.wikipedia.org/wiki/Box-drawing_character
10
+ # Refer to UTF-8 U+2500 to U+257F for border characters. More
11
+ # details can be found at:
12
12
  #
13
- # Using the '\uXXXX' variant produces gaps in the border, whilst the
14
- # '\xXX' renders 'nicely'.
13
+ # http://en.wikipedia.org/wiki/Box-drawing_character
14
+ #
15
+ # Using the '\uXXXX' variant produces gaps in the border, whilst
16
+ # the '\xXX' renders 'nicely'.
15
17
  #
16
18
  module Borders
17
19