rbcurse-extras 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. data/README.md +75 -0
  2. data/VERSION +1 -0
  3. data/examples/data/list.txt +300 -0
  4. data/examples/data/lotr.txt +12 -0
  5. data/examples/data/table.txt +36 -0
  6. data/examples/data/tasks.txt +27 -0
  7. data/examples/data/unix1.txt +21 -0
  8. data/examples/inc/qdfilechooser.rb +70 -0
  9. data/examples/inc/rfe_renderer.rb +121 -0
  10. data/examples/newtabbedwindow.rb +100 -0
  11. data/examples/rfe.rb +1236 -0
  12. data/examples/test2.rb +670 -0
  13. data/examples/testeditlist.rb +78 -0
  14. data/examples/testtable.rb +270 -0
  15. data/examples/testvimsplit.rb +141 -0
  16. data/lib/rbcurse/extras/include/celleditor.rb +112 -0
  17. data/lib/rbcurse/extras/include/checkboxcellrenderer.rb +57 -0
  18. data/lib/rbcurse/extras/include/comboboxcellrenderer.rb +30 -0
  19. data/lib/rbcurse/extras/include/defaultlistselectionmodel.rb +79 -0
  20. data/lib/rbcurse/extras/include/listkeys.rb +37 -0
  21. data/lib/rbcurse/extras/include/listselectable.rb +144 -0
  22. data/lib/rbcurse/extras/include/tableextended.rb +40 -0
  23. data/lib/rbcurse/extras/widgets/horizlist.rb +203 -0
  24. data/lib/rbcurse/extras/widgets/menutree.rb +63 -0
  25. data/lib/rbcurse/extras/widgets/multilinelabel.rb +142 -0
  26. data/lib/rbcurse/extras/widgets/rcomboedit.rb +256 -0
  27. data/lib/rbcurse/extras/widgets/rlink.rb.moved +27 -0
  28. data/lib/rbcurse/extras/widgets/rlistbox.rb +1247 -0
  29. data/lib/rbcurse/extras/widgets/rmenulink.rb.moved +21 -0
  30. data/lib/rbcurse/extras/widgets/rmulticontainer.rb +304 -0
  31. data/lib/rbcurse/extras/widgets/rmultisplit.rb +722 -0
  32. data/lib/rbcurse/extras/widgets/rmultitextview.rb +306 -0
  33. data/lib/rbcurse/extras/widgets/rpopupmenu.rb +755 -0
  34. data/lib/rbcurse/extras/widgets/rtable.rb +1758 -0
  35. data/lib/rbcurse/extras/widgets/rvimsplit.rb +800 -0
  36. data/lib/rbcurse/extras/widgets/table/tablecellrenderer.rb +86 -0
  37. data/lib/rbcurse/extras/widgets/table/tabledatecellrenderer.rb +98 -0
  38. metadata +94 -0
@@ -0,0 +1,78 @@
1
+ require 'rbcurse/core/util/app'
2
+ require 'rbcurse/core/include/appmethods'
3
+ require 'rbcurse/extras/widgets/rlistbox'
4
+
5
+ def my_help_text
6
+ <<-eos
7
+ File : testeditlist.rb
8
+
9
+ =========================================================================
10
+ Basic Usage
11
+
12
+ This simple example shows the old editable list. This was the original
13
+ list, but pretty complicated due to editing. You can switch off the editing.
14
+
15
+ Type Alt-: to see customization menu. You may select:
16
+
17
+ * edit_toggle: when false you are always in insert mode.
18
+ when true, you are in command mode, but can go into
19
+ edit/insert mode by pressing <edit_toggle_key> currently
20
+ C-e. You can also complete edit using <ESC>.
21
+ You may cancel edit using C-c or C-g.
22
+
23
+ * one_key_selection : if you are not in insert mode you can switch this on, so pressing
24
+ any alphabet takes you to first row starting with that char.
25
+ If false, then you are in so-called "vim" mode, so u can use j/k/gg/G etc keys.
26
+ To get the same functionality of one-key, use f<char>.
27
+
28
+ Navigation: use arrow keys, or C-n, C-p, C-d, C-f. In command mode, pressing '?' displays
29
+ key-bindings.
30
+
31
+
32
+
33
+ =========================================================================
34
+ :n or Alt-n for next buffer. 'q' to quit.
35
+
36
+ eos
37
+ end
38
+
39
+
40
+
41
+ App.new do
42
+ #
43
+ # general purpose command to catch miscellaneous actions that can be
44
+ # executed in the same way. Or even take complex command lines
45
+ # such as what vim has.
46
+ def execute_this *cmd
47
+ f = @form.get_current_field
48
+ w = f
49
+ name = w.text.split()[0]
50
+ cmd = cmd[0].to_s
51
+ end
52
+
53
+ colors = Ncurses.COLORS
54
+ back = :blue
55
+ back = 234 if colors >= 256
56
+ header = app_header "rbcurse #{Rbcurse::VERSION}", :text_center => "Listbox Demo", :text_right =>"New Improved!", :color => :white, :bgcolor => back #, :attr => :bold
57
+ message "F10 - Exit, F1 - Help, : - Menu"
58
+ install_help_text my_help_text
59
+
60
+ alist = File.open("data/list.txt",'r').readlines.map{|i| i.chomp }
61
+ #atable = File.open("data/table.txt",'r').readlines
62
+
63
+ #stack :margin_top => 1, :width => :expand, :height => FFI::NCurses.LINES-2 do
64
+ max = FFI::NCurses.LINES-2
65
+ lb = Listbox.new @form, :list => alist, :suppress_borders => false, :title => "[ brew packages ]",
66
+ :left_margin => 1, :width => 100, :name => 'lb1', :height => max, :row => 1, :col => 1, :cell_editing_allowed => true
67
+ lb.show_selector = false
68
+ #require 'rbcurse/core/include/widgetmenu'
69
+ #lb.extend(WidgetMenu)
70
+ #lb.add_menu_item('z', 'test from app', 'some desc', Proc.new { alert "Hello world" } )
71
+ lb.action_manager().add_action( Action.new("&Testing from app"){ alert "testing from app" } )
72
+
73
+ #end
74
+ status_line :row => FFI::NCurses.LINES-1
75
+ #label({:text => "F1 Help, F10 Quit. : for menu. Press F4 and F5 to test popup, space or enter to select", :row => Ncurses.LINES-1, :col => 0})
76
+
77
+
78
+ end # app
@@ -0,0 +1,270 @@
1
+ require 'rbcurse'
2
+ require 'rbcurse/core/widgets/rcombo'
3
+ require 'rbcurse/extras/widgets/rtable'
4
+ require 'rbcurse/extras/include/celleditor'
5
+ #require 'rbcurse/table/tablecellrenderer'
6
+ require 'rbcurse/extras/include/comboboxcellrenderer'
7
+ require 'rbcurse/core/include/action'
8
+
9
+ ##
10
+ # a renderer which paints alternate lines with
11
+ # another color, for people with _poor_ taste.
12
+ class MyRenderer < TableCellRenderer
13
+ def initialize text="", config={}, &block
14
+ super
15
+ @orig_bgcolor = @bgcolor
16
+ @orig_color = @color
17
+ end
18
+ def repaint graphic, r=@row,c=@col, value=@text, focussed=false, selected=false
19
+ @bgcolor = @orig_bgcolor
20
+ @color = @orig_color
21
+ if !focussed and !selected
22
+ @bgcolor = r % 2 == 0 ? "green" : @orig_bgcolor
23
+ @color = r % 2 == 0 ? "black" : @orig_color
24
+ end
25
+ super
26
+ end
27
+ end
28
+ if $0 == __FILE__
29
+ include RubyCurses
30
+ include RubyCurses::Utils
31
+
32
+ begin
33
+ # Initialize curses
34
+ VER::start_ncurses # this is initializing colors via ColorMap.setup
35
+ $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
36
+ $log.level = Logger::DEBUG
37
+
38
+ @window = VER::Window.root_window
39
+
40
+ catch(:close) do
41
+ colors = Ncurses.COLORS
42
+ $log.debug "START #{colors} colors ---------"
43
+ @form = Form.new @window
44
+ @window.printstring 0,30,"Demo of Ruby Curses Table: Edit, Resize, Insert, Move, Delete Row/Col", $datacolor
45
+ r = 1; c = 1;
46
+ data = [
47
+ ["Blood Diamond",3,"Hanz Zimmer",3.47, true, "WIP"],
48
+ ["Wish you were here",92,"Pink Floyd",412, true, "Fin"],
49
+ ["You're beautiful",3,"James Blunt",3.21, true, "WIP"],
50
+ ["I believe in love",4,"Paula Cole",110.0, false, "Cancel"],
51
+ ["Red Sky at night",4,"Dave Gilmour",102.72, false, "Postp"],
52
+ ["Midnight and you",8,"Barry White",12.72, false, "Todo"],
53
+ ["Run Like Hell",18,"Roger Waters",12.72, false, "Todo"],
54
+ ["Let the music play",9,"Barry White",12.2, false, "WIP"],
55
+ ["Titanic",nil,"Celine Dion",112.7, true, "Cancel"],
56
+ ["Believe",9,"Elton John",12.2, false, "Todo"],
57
+ ["Once upon a time",9,"Dire Straits",12.2, false, "Todo"],
58
+ ["Circle Of Life",9,"Elton John",12.2, false, "Todo"],
59
+ ["Money",10,"Dark Side",12.2, false, "Todo"],
60
+ ["Like a prayer",163,"Charlotte Perrelli",5.4, false, "WIP"]]
61
+
62
+ colnames = %w[ Song Cat Artist Ratio Flag Status]
63
+ statuses = ["Todo", "WIP", "Fin", "Cancel", "Postp"]
64
+
65
+ texta = Table.new @form do
66
+ name "mytext"
67
+ row r
68
+ col c
69
+ width 78
70
+ height Ncurses.LINES-10
71
+ title "Randomly picked songs"
72
+ #title_attrib (Ncurses::A_REVERSE | Ncurses::A_BOLD)
73
+ cell_editing_allowed true
74
+ #editing_policy :EDITING_AUTO
75
+ set_data data, colnames
76
+ end
77
+ require 'rbcurse/core/include/widgetmenu'
78
+ texta.extend(WidgetMenu)
79
+ sel_col = Variable.new 0
80
+ sel_col.value = 0
81
+ tcm = texta.get_table_column_model
82
+ selcolname = texta.get_column_name sel_col.value
83
+ #
84
+ ## key bindings fo texta
85
+ # column widths
86
+ tcm.column(0).width 24
87
+ tcm.column(1).width 5
88
+ tcm.column(2).width 18
89
+ #tcm.column(2).editable false
90
+ tcm.column(3).width 7
91
+ tcm.column(4).width 5
92
+ tcm.column(5).width 8
93
+ texta.configure() do
94
+ bind_key(330, 'delete column') { texta.remove_column(tcm.column(texta.focussed_col)) rescue "" }
95
+ bind_key(?+, 'widen column') {
96
+ acolumn = texta.get_column selcolname
97
+ w = acolumn.width + 1
98
+ acolumn.width w
99
+ #texta.table_structure_changed
100
+ }
101
+ bind_key(?-, 'reduce width') {
102
+ acolumn = texta.get_column selcolname
103
+ w = acolumn.width - 1
104
+ if w > 3
105
+ acolumn.width w
106
+ #texta.table_structure_changed
107
+ end
108
+ }
109
+ bind_key(?>, 'move column right') {
110
+ colcount = tcm.column_count-1
111
+ #texta.move_column sel_col.value, sel_col.value+1 unless sel_col.value == colcount
112
+ col = texta.focussed_col
113
+ texta.move_column col, col+1 unless col == colcount
114
+ }
115
+ bind_key(?<, 'move column left') {
116
+ col = texta.focussed_col
117
+ texta.move_column col, col-1 unless col == 0
118
+ #texta.move_column sel_col.value, sel_col.value-1 unless sel_col.value == 0
119
+ }
120
+ #bind_key(KEY_RIGHT) { sel_col.value = sel_col.value+1; current_column sel_col.value}
121
+ #bind_key(KEY_LEFT) { sel_col.value = sel_col.value-1;current_column sel_col.value}
122
+ end
123
+ keylabel = RubyCurses::Label.new @form, {'text' => "", "row" => Ncurses.LINES-6, "col" => c, "color" => "yellow", "bgcolor"=>"blue", "display_length"=>Ncurses.COLS-1, "height"=>2}
124
+ eventlabel = RubyCurses::Label.new @form, {'text' => "Events:", "row" => Ncurses.LINES-5, "col" => c, "color" => "white", "bgcolor"=>"blue", "display_length"=>Ncurses.COLS-1, "height"=>2}
125
+
126
+ # report some events
127
+ texta.table_model.bind(:TABLE_MODEL_EVENT){|e| eventlabel.text = "Event: #{e}"}
128
+ texta.get_table_column_model.bind(:TABLE_COLUMN_MODEL_EVENT){|e| eventlabel.text = "Event: #{e}"}
129
+ texta.bind(:TABLE_TRAVERSAL_EVENT){|e| eventlabel.text = "Event: #{e}"}
130
+
131
+ @help = "C-q to quit. M-? Keys, ENTER - edit toggle, M-Tab (exit table) C-n C-p M-0 M-9 Columns:- Narrow, + expand, > < switch"
132
+ RubyCurses::Label.new @form, {'text' => @help, "row" => Ncurses.LINES-3, "col" => 2, "color" => "yellow", "height"=>2}
133
+
134
+ str_renderer = TableCellRenderer.new ""
135
+ num_renderer = TableCellRenderer.new "", { "justify" => :right }
136
+ bool_renderer = CheckBoxCellRenderer.new "", {"parent" => texta, "display_length"=>5}
137
+ combo_renderer = RubyCurses::ComboBoxCellRenderer.new nil, {"parent" => texta, "display_length"=> 8}
138
+ combo_editor = RubyCurses::CellEditor.new(RubyCurses::ComboBox.new nil, {"focusable"=>false, "visible"=>false, "list"=>statuses, "display_length"=>8})
139
+ texta.set_default_cell_renderer_for_class "String", str_renderer
140
+ texta.set_default_cell_renderer_for_class "Fixnum", num_renderer
141
+ texta.set_default_cell_renderer_for_class "Float", num_renderer
142
+ texta.set_default_cell_renderer_for_class "TrueClass", bool_renderer
143
+ texta.set_default_cell_renderer_for_class "FalseClass", bool_renderer
144
+ texta.get_table_column_model.column(5).cell_editor = combo_editor
145
+ =begin
146
+ field = Field.new @form do
147
+ name "value"
148
+ row r+18
149
+ col c
150
+ display_length 30
151
+ bgcolor "cyan"
152
+ set_label Label.new @form, {'text' => "Value", 'mnemonic'=> 'V'}
153
+ # bind :ENTER do $editing = true end
154
+ # bind :LEAVE do $editing = false end
155
+ end
156
+ =end
157
+ buttrow = Ncurses.LINES-4
158
+ b_newrow = Button.new @form do
159
+ text "&New"
160
+ row buttrow
161
+ col c
162
+ bind(:ENTER) { eventlabel.text "New button adds a new row at the bottom " }
163
+ end
164
+ tm = texta.table_model
165
+ b_newrow.command {
166
+ cc = texta.get_table_column_model.column_count
167
+ # need to get datatypes etc, this is just a junk test
168
+ tmp=[]
169
+ #0.upto(cc-1) { tmp << "" }
170
+ 0.upto(cc-1) { tmp << nil }
171
+ tm << tmp
172
+ #texta.table_data_changed
173
+ keylabel.text = "Added a row"
174
+ alert("Added a row at bottom of table")
175
+
176
+ }
177
+
178
+ # using ampersand to set mnemonic
179
+ b_delrow = Button.new @form do
180
+ text "&Delete"
181
+ row buttrow
182
+ col c+10
183
+ bind(:ENTER) { eventlabel.text "Deletes focussed row" }
184
+ end
185
+ b_delrow.command { |form|
186
+ row = texta.focussed_row
187
+ if confirm("Do your really want to delete row #{row}?")
188
+ tm.delete_at row
189
+ #texta.table_data_changed
190
+ else
191
+ #$message.value = "Quit aborted"
192
+ end
193
+ }
194
+ b_change = Button.new @form do
195
+ text "&Lock"
196
+ row buttrow
197
+ col c+20
198
+ command {
199
+ r = texta.focussed_row
200
+ c = sel_col.value
201
+ #$log.debug " Update gets #{field.getvalue.class}"
202
+ #texta.set_value_at(r, c, field.getvalue)
203
+ toggle = texta.column(texta.focussed_col()).editable
204
+ if toggle.nil? or toggle==true
205
+ toggle = false
206
+ text "Un&lock"
207
+ else
208
+ toggle = true
209
+ text "&Lock "
210
+ end
211
+ eventlabel.text "Set column #{texta.focussed_col()} editable to #{toggle}"
212
+ texta.column(texta.focussed_col()).editable toggle
213
+ alert("Set column #{texta.focussed_col()} editable to #{toggle}")
214
+ }
215
+ bind(:ENTER) { eventlabel.text "Toggles editable state of current column " }
216
+ end
217
+ b_insert = Button.new @form do
218
+ text "&Insert"
219
+ row buttrow
220
+ col c+32
221
+ command {
222
+ # this does not trigger a data change since we are not updating model. so update
223
+ # on pressing up or down
224
+ #0.upto(100) { |i| data << ["test", rand(100), "abc:#{i}", rand(100)/2.0]}
225
+ #texta.table_data_changed
226
+ }
227
+ bind(:ENTER) { eventlabel.text "Does nothing " }
228
+ end
229
+
230
+
231
+ @form.repaint
232
+ @window.wrefresh
233
+ Ncurses::Panel.update_panels
234
+ while((ch = @window.getchar()) != ?\C-q.getbyte(0) )
235
+ break if ch == KEY_F10
236
+ begin
237
+ colcount = tcm.column_count-1
238
+ s = keycode_tos ch
239
+ keylabel.text = "Pressed #{ch} , #{s}"
240
+ @form.handle_key(ch)
241
+
242
+ sel_col.value = tcm.column_count-1 if sel_col.value > tcm.column_count-1
243
+ sel_col.value = 0 if sel_col.value < 0
244
+ selcolname = texta.get_column_name sel_col.value
245
+ keylabel.text = "Pressed #{ch} , #{s}. Column selected #{texta.focussed_col}: Width:#{tcm.column(sel_col.value).width} #{selcolname}. Focussed Row: #{texta.focussed_row}, Rows: #{texta.table_model.row_count}, Cols: #{colcount}"
246
+ s = texta.get_value_at(texta.focussed_row, texta.focussed_col)
247
+ #s = s.to_s
248
+ ## $log.debug " updating Field #{s}, #{s.class}"
249
+ ## field.set_buffer s unless field.state == :HIGHLIGHTED # $editing
250
+
251
+ @form.repaint
252
+ @window.wrefresh
253
+ rescue => ex
254
+ $log.debug( ex) if ex
255
+ $log.debug(ex.backtrace.join("\n")) if ex
256
+ #alert ex.to_s
257
+ textdialog ex
258
+ end
259
+ end
260
+ end
261
+ rescue => ex
262
+ ensure
263
+ @window.destroy if !@window.nil?
264
+ VER::stop_ncurses
265
+ p ex if ex
266
+ p(ex.backtrace.join("\n")) if ex
267
+ $log.debug( ex) if ex
268
+ $log.debug(ex.backtrace.join("\n")) if ex
269
+ end
270
+ end
@@ -0,0 +1,141 @@
1
+ # This is a new kind of splitpane, inspired by the vim editor.
2
+ # I was deeply frustrated with the Java kind of splitpane,
3
+ # which requires splitpanes within splitpanes to get several split.
4
+ # This is an attempt at getting many splits, keeping them at one level
5
+ # and keeping the interface as simple as possible, with minimal input
6
+ # from user.
7
+ # It usually takes a listbox or textview or textarea.
8
+ # It can also take an array, or string or hash.
9
+ # It supports moving the split, and increasing or decreasing the current box to some extent.
10
+ # Typically if the split is vertical, add stacks the components, one below the other.
11
+ # If horizontal, if will flow the components, to the right of previous. This can be overriden by passing
12
+ # type as :STACK or :FLOW.
13
+ #
14
+ # This does not support changing the orientation at run time, that's nice for demos, but a pain
15
+ # to get right, and results in a lot of extra code, meaning more bugs.
16
+ # TODO: create a class that contains component array and a pointer so it can give next/prev
17
+ # i am tired of maintaining this everywhere.
18
+ require 'rbcurse'
19
+ require 'rbcurse/extras/widgets/rlistbox'
20
+ require 'rbcurse/core/widgets/rtextview'
21
+ require 'rbcurse/extras/widgets/rvimsplit'
22
+
23
+ require 'rbcurse/core/include/appmethods'
24
+ def my_help_text
25
+ <<-eos
26
+ File: testvimsplit.rb
27
+
28
+ Basic Usage
29
+
30
+ An example of a vimsplit containing various objects, which have been placed
31
+ with weightages. The vimsplit has one main split which is either horizontal
32
+ or vertical with a divider. You can activate the divider using F3. It then becomes
33
+ focusable. Using the arrows keys one can then move the divider up or down (or right
34
+ left for a vertical divider). F3 will toggles focusable.
35
+
36
+ This allows us to have master-detail relationships as in mail clients, or file managers
37
+ that show directories on one side and files on the other. One can place more dividers (as
38
+ in appemail.rb), so as to resize deeper splits and one may bind to the divider's DRAG event
39
+ to get all one's components to resize correctly. See appemail.rb in the old rbcurse examples folder,
40
+ I may not keep it updated since it relies on mbox and thus may not be easy for others to test.
41
+
42
+ Pressing '?' shows key-bindings for the vimplit, sadly not for underlying component.
43
+
44
+ =========================================================================
45
+ :n or Alt-n for next buffer. 'q' or even <Esc-Esc> to quit.
46
+
47
+ eos
48
+ end
49
+ if $0 == __FILE__
50
+ class Tester
51
+ def initialize
52
+ acolor = $reversecolor
53
+ end
54
+ def run
55
+ @window = VER::Window.root_window
56
+ @form = Form.new @window
57
+ install_help_text my_help_text
58
+ @form.bind_key(FFI::NCurses::KEY_F1, 'help') { display_app_help }
59
+
60
+
61
+ h = 20; w = 75; t = 3; l = 4
62
+
63
+ vf = :H
64
+ @vim = VimSplit.new @form, {:row => 2, :col => 5, :width => :EXPAND, :height => 25, :orientation => vf, :weight => 0.6}
65
+ lb = Listbox.new nil, :list => ["ruby","perl","lisp","java", "scala"] , :name => "mylist"
66
+ lb1 = Listbox.new nil, :list => ["roger","borg","laver","edberg", "sampras","ashe"] , :name => "mylist1"
67
+
68
+ lb2 = Listbox.new nil, :list => `gem list --local`.split("\n") , :name => "mylist2"
69
+
70
+ alist = %w[ ruby perl python java jruby macruby rubinius rails rack sinatra gawk zsh bash groovy]
71
+ str = "Hello people of this world.\nThis is a textbox.\nUse arrow keys, j/k/h/l/gg/G/C-a/C-e/C-d/C-b\n"
72
+ str << alist.join("\n")
73
+ stfl = vf == :V ? :FLOW : :STACK
74
+ @vim.add lb, :FIRST, :AUTO
75
+ @vim.add lb1, :FIRST, :AUTO #nil #0.7:AUTO
76
+ @vim.add ["mercury","venus","earth","mars","jupiter", "saturn"], :FIRST, :AUTO
77
+ @vim.add alist, :FIRST, 0.4, stfl
78
+ #@vim.add alist, :FIRST, nil, stfl
79
+ @vim.add alist.shuffle, :FIRST, 0.6, stfl
80
+ @vim.add lb2, :SECOND, :AUTO
81
+ @vim.add str, :SECOND, :AUTO
82
+ ok_button = Button.new @form do
83
+ text "+"
84
+ name "+"
85
+ row 27
86
+ col 10
87
+ end
88
+ #ok_button.command { |form| @vim.weight(@vim.weight + 0.1) }
89
+ ok_button.command { @vim.increase_weight }
90
+
91
+
92
+ k_button = Button.new @form do
93
+ text "-"
94
+ name "-"
95
+ row 27
96
+ col 17
97
+ end
98
+ #k_button.command { |form| @vim.weight( @vim.weight - 0.1) }
99
+ k_button.command { |form| @vim.decrease_weight }
100
+
101
+ #
102
+ @help = "F10 to quit. "
103
+ RubyCurses::Label.new @form, {'text' => @help, "row" => 1, "col" => 2, "color" => "yellow"}
104
+ @form.repaint
105
+ @window.wrefresh
106
+ Ncurses::Panel.update_panels
107
+ ctr = 0
108
+ row = 2
109
+ while((ch = @window.getchar()) != Ncurses::KEY_F10 )
110
+ ret = @form.handle_key(ch)
111
+ @window.wrefresh
112
+ #ret = @vim.handle_key ch
113
+ if ret == :UNHANDLED
114
+ str = keycode_tos ch
115
+ $log.debug " UNHANDLED #{str} by Vim #{ret} "
116
+ end
117
+ end
118
+
119
+ @window.destroy
120
+
121
+ end
122
+ end
123
+ include RubyCurses
124
+ include RubyCurses::Utils
125
+ # Initialize curses
126
+ begin
127
+ # XXX update with new color and kb
128
+ VER::start_ncurses # this is initializing colors via ColorMap.setup
129
+ $log = Logger.new("rbc13.log")
130
+ $log.level = Logger::DEBUG
131
+ n = Tester.new
132
+ n.run
133
+ rescue => ex
134
+ ensure
135
+ VER::stop_ncurses
136
+ p ex if ex
137
+ puts(ex.backtrace.join("\n")) if ex
138
+ $log.debug( ex) if ex
139
+ $log.debug(ex.backtrace.join("\n")) if ex
140
+ end
141
+ end