vimamsa 0.1.7 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@
15
15
  # 'C , r v b'=> 'revert_buffer',
16
16
  #
17
17
  # In insert mode: press and hold ctrl, press "a"
18
- # 'I ctrl-a'=> '$buffer.jump(BEGINNING_OF_LINE)',
18
+ # 'I ctrl-a'=> 'vma.buf.jump(BEGINNING_OF_LINE)',
19
19
  #
20
20
 
21
21
  $cnf = {} # TODO
@@ -36,7 +36,7 @@ setcnf :indent_based_on_last_line, true
36
36
  setcnf :extensions_to_open, [".txt", ".h", ".c", ".cpp", ".hpp", ".rb", ".inc", ".php", ".sh", ".m", ".gd", ".js"]
37
37
 
38
38
  class State
39
- attr_accessor :key_name, :eval_rule, :children, :action, :label, :major_modes
39
+ attr_accessor :key_name, :eval_rule, :children, :action, :label, :major_modes, :level
40
40
 
41
41
  def initialize(key_name, eval_rule = "")
42
42
  @key_name = key_name
@@ -44,6 +44,7 @@ class State
44
44
  @children = []
45
45
  @major_modes = []
46
46
  @action = nil
47
+ @level = 0
47
48
  end
48
49
 
49
50
  def to_s()
@@ -86,6 +87,7 @@ class KeyBindingTree
86
87
  # $kbd.add_mode("I", :insert)
87
88
  def add_mode(id, label)
88
89
  mode = State.new(id)
90
+ mode.level = 1
89
91
  @modes[label] = mode
90
92
  @root.children << mode
91
93
  if @default_mode == nil
@@ -127,22 +129,21 @@ class KeyBindingTree
127
129
  @match_state.each { |parent|
128
130
  parent.children.each { |c|
129
131
  # printf(" KEY MATCH: ")
130
- # puts [c.key_name, key_name].inspect
132
+ # debug [c.key_name, key_name].inspect
131
133
  if c.key_name == key_name and c.eval_rule == ""
132
134
  new_state << c
133
135
  elsif c.key_name == key_name and c.eval_rule != ""
134
- puts "CHECK EVAL: #{c.eval_rule}"
136
+ debug "CHECK EVAL: #{c.eval_rule}"
135
137
  if eval(c.eval_rule)
136
138
  new_state << c
137
- puts "EVAL TRUE"
139
+ debug "EVAL TRUE"
138
140
  else
139
- puts "EVAL FALSE"
141
+ debug "EVAL FALSE"
140
142
  end
141
143
  end
142
144
  }
143
145
  }
144
146
 
145
-
146
147
  if new_state.any? # Match found
147
148
  @match_state = new_state
148
149
  return new_state
@@ -153,6 +154,11 @@ class KeyBindingTree
153
154
  end
154
155
  end
155
156
 
157
+ def show_state_trail
158
+ (st, children) = get_state_trail_str()
159
+ vma.gui.statnfo.markup = "<span weight='ultrabold'>#{st}</span>"
160
+ end
161
+
156
162
  def set_mode(label)
157
163
  @mode_history << @mode_root_state
158
164
 
@@ -195,7 +201,7 @@ class KeyBindingTree
195
201
  end
196
202
 
197
203
  @state_trail = [@mode_root_state]
198
- # puts get_state_trail_str()
204
+ # debug get_state_trail_str()
199
205
  # $next_command_count = nil # TODO: set somewhere else?
200
206
  end
201
207
 
@@ -205,6 +211,7 @@ class KeyBindingTree
205
211
  # @cur_state = @root
206
212
  stack = [[@root, ""]]
207
213
  lines = []
214
+
208
215
  while stack.any?
209
216
  t, p = *stack.pop # t = current state, p = current path
210
217
  if t.children.any?
@@ -212,14 +219,27 @@ class KeyBindingTree
212
219
  if c.eval_rule.size > 0
213
220
  new_p = "#{p} #{c.key_name}(#{c.eval_rule})"
214
221
  else
215
- new_p = "#{p} #{c.key_name}"
222
+ if c.level == 1
223
+ new_p = "#{p} [#{c.key_name}]"
224
+ else
225
+ new_p = "#{p} #{c.key_name}"
226
+ end
216
227
  end
217
228
  stack << [c, new_p]
218
229
  }
219
230
  # stack.concat[t.children]
220
231
  else
221
- # s += p + " : #{t.action}\n"
222
- lines << p + " : #{t.action}"
232
+ method_desc = t.action
233
+ if t.action.class == Symbol
234
+ if !$actions[t.action].nil?
235
+ a = $actions[t.action].method_name
236
+ if !a.nil? and !a.empty?
237
+ method_desc = a
238
+ end
239
+ end
240
+ end
241
+
242
+ lines << p + " : #{method_desc}"
223
243
  end
224
244
  end
225
245
  s = lines.sort.join("\n")
@@ -227,21 +247,26 @@ class KeyBindingTree
227
247
  end
228
248
 
229
249
  def get_state_trail_str
230
- s = ""
231
250
  s_trail = ""
232
251
  last_state = @state_trail.last
233
252
  last_state = last_state[0] if last_state.class == Array
253
+ first = true
234
254
  for st in @state_trail
235
255
  st = st[0] if st.class == Array
236
- s_trail << " #{st.to_s}"
256
+ if first
257
+ s_trail << "[#{st.to_s}]"
258
+ else
259
+ s_trail << " #{st.to_s}"
260
+ end
261
+ first = false
237
262
  end
238
- s << "CUR STATE: #{s_trail}\n"
263
+ children = ""
239
264
  for cstate in last_state.children
240
265
  act_s = "..."
241
266
  act_s = cstate.action.to_s if cstate.action != nil
242
- s << " #{cstate.to_s} #{act_s}\n"
267
+ children << " #{cstate.to_s} #{act_s}\n"
243
268
  end
244
- return s
269
+ return [s_trail, children]
245
270
  end
246
271
 
247
272
  # Modifies state of key binding tree (move to new state) based on received event
@@ -305,20 +330,6 @@ class KeyBindingTree
305
330
 
306
331
  if new_state != nil
307
332
  @state_trail << new_state
308
- puts get_state_trail_str()
309
- # # puts "CUR STATE: #{@state_trail.collect{|x| x.to_s}.join}"
310
- # s_trail = ""
311
- # for st in @state_trail
312
- # st = st[0] if st.class == Array
313
- # s_trail << " #{st.to_s}"
314
- # end
315
- # puts "CUR STATE: #{s_trail}"
316
- # for cstate in new_state[0].children
317
- # act_s = "..."
318
- # act_s = cstate.action.to_s if cstate.action != nil
319
- # puts " #{cstate.to_s} #{act_s}"
320
- # end
321
- # new_state[0].children.collect{|x|x.to_s}
322
333
  end
323
334
 
324
335
  if new_state == nil
@@ -330,7 +341,7 @@ class KeyBindingTree
330
341
  end
331
342
 
332
343
  if event_type == :key_release and c == "shift!"
333
- # Pressing a modifier key (shift) puts state back to root
344
+ # Pressing a modifier key (shift) sets state back to root
334
345
  # only on key release when no other key has been pressed
335
346
  # after said modifier key (shift).
336
347
  set_state_to_root
@@ -346,109 +357,22 @@ class KeyBindingTree
346
357
 
347
358
  if s_act.any? and !state_with_children.any?
348
359
  eval_s = s_act.first.action if eval_s == nil
349
- puts "FOUND MATCH:#{eval_s}"
350
- puts "CHAR: #{c}"
360
+ debug "FOUND MATCH:#{eval_s}"
361
+ debug "CHAR: #{c}"
351
362
  c.gsub!("\\", %q{\\\\} * 4) # Escape \ -chars
352
363
  c.gsub!("'", "#{'\\' * 4}'") # Escape ' -chars
353
364
 
354
365
  eval_s.gsub!("<char>", "'#{c}'") if eval_s.class == String
355
- puts eval_s
356
- puts c
366
+ debug eval_s
367
+ debug c
357
368
  handle_key_bindigs_action(eval_s, c)
358
369
  set_state_to_root
359
370
  end
360
371
  end
361
372
 
362
- return true
363
- end
364
-
365
- # Receive keyboard event from Qt
366
- def handle_key_event(event)
367
- start_profiler
368
- # puts "GOT KEY EVENT: #{key.inspect}"
369
- debug "GOT KEY EVENT:: #{event} #{event[2]}"
370
- debug "|#{event.inspect}|"
371
- $debuginfo["cur_event"] = event
372
-
373
- t1 = Time.now
374
-
375
- keycode = event[0]
376
- event_type = event[1]
377
- modifierinfo = event[4]
378
-
379
- event[3] = event[2]
380
- # String representation of received key
381
- key_str = event[2]
382
-
383
- @modifiers.delete(Qt::Key_Alt) if event[4] & ALTMODIFIER == 0
384
- @modifiers.delete(Qt::Key_Control) if event[4] & CONTROLMODIFIER == 0
385
- @modifiers.delete(Qt::Key_Shift) if event[4] & SHIFTMODIFIER == 0
386
-
387
- # Add as modifier if ctrl, alt or shift
388
- if modifierinfo & ALTMODIFIER != 0 or modifierinfo & CONTROLMODIFIER != 0 or modifierinfo & SHIFTMODIFIER != 0
389
- # And keypress and not already a modifier
390
- if event_type == KEY_PRESS and !@modifiers.include?(keycode)
391
- @modifiers << keycode
392
- end
393
- end
394
-
395
- # puts "----D------------"
396
- # puts @modifiers.inspect
397
- # puts event.inspect
398
- # puts event[4] & ALTMODIFIER
399
- # puts "-----------------"
400
-
401
- @modifiers.delete(keycode) if event_type == KEY_RELEASE
402
-
403
- # uval = keyval_to_unicode(event[0])
404
- # event[3] = [uval].pack('c*').force_encoding('UTF-8') #TODO: 32bit?
405
- # debug("key_code_to_uval: uval: #{uval} uchar:#{event[3]}")
406
-
407
- if $event_keysym_translate_table.include?(keycode)
408
- key_str = $event_keysym_translate_table[keycode]
409
- end
410
-
411
- # Prefix string representation with modifiers, e.g. ctrl-shift-a
412
- key_prefix = ""
413
- @modifiers.each { |pressed_key|
414
- if $event_keysym_translate_table[pressed_key]
415
- key_prefix += $event_keysym_translate_table[pressed_key] + "-"
416
- end
417
- }
418
-
419
- # Get char based on keycode
420
- # to produce prefixed_key_str "shift-ctrl-a" instead of "shift-ctrl-\x01"
421
- key_str2 = key_str
422
- if $translate_table.include?(keycode)
423
- key_str2 = $translate_table[keycode].downcase
424
- end
425
- # puts "key_str=|#{key_str}| key_str=|#{key_str.inspect}| key_str2=|#{key_str2}|"
426
- prefixed_key_str = key_prefix + key_str2
427
-
428
- # Space is only key in $event_keysym_translate_table
429
- # which is representable by single char
430
- key_str = " " if key_str == "space" # HACK
373
+ show_state_trail #TODO: check if changed
431
374
 
432
- # if keycode == @last_event[0] and event_type == KEY_RELEASE
433
- # puts "KEY! key_str=|#{key_str}| prefixed_key_str=|#{prefixed_key_str}|"
434
- # end
435
-
436
- if key_str != "" or prefixed_key_str != ""
437
- if keycode == @last_event[0] and event_type == KEY_RELEASE
438
- # If key is released immediately after pressed with no other events between
439
- match_key_conf(key_str + "!", prefixed_key_str + "!", event_type)
440
- elsif event_type == KEY_PRESS
441
- match_key_conf(key_str, prefixed_key_str, event_type)
442
- end
443
- @last_event = event #TODO: outside if?
444
- end
445
-
446
- # gui_refresh_cursor
447
-
448
- event_handle_time = Time.now - t1
449
- debug "RB key event handle time: #{event_handle_time}" if event_handle_time > 1 / 40.0
450
- render_buffer($buffer)
451
- end_profiler
375
+ return true
452
376
  end
453
377
 
454
378
  def bindkey(key, action)
@@ -485,7 +409,7 @@ class KeyBindingTree
485
409
  m = key.match(/^(\S+)\s(\S.*)$/)
486
410
  if m
487
411
  modetmp = m[1]
488
- puts [key, modetmp, m].inspect
412
+ debug [key, modetmp, m].inspect
489
413
  modes = modetmp.split("") if modetmp.match(/^\p{Lu}+$/) # Uppercase
490
414
  modes = [modetmp] if modetmp.match(/^\p{Ll}+$/) # Lowercase
491
415
  keydef = m[2]
@@ -561,7 +485,7 @@ class KeyBindingTree
561
485
  # like '20j' => go to next line 20 times.
562
486
  end
563
487
  rescue SyntaxError
564
- debug("SYNTAX ERROR with eval cmd #{action}: " + $!.to_s)
488
+ message("SYNTAX ERROR with eval cmd #{action}: " + $!.to_s)
565
489
  # rescue NoMethodError
566
490
  # debug("NoMethodError with eval cmd #{action}: " + $!.to_s)
567
491
  # rescue NameError
@@ -1,9 +1,8 @@
1
-
2
- bindkey ["VCB M","B m"], :run_last_macro
1
+ bindkey ["VCB M", "B m"], :run_last_macro
3
2
 
4
3
  bindkey "VC s", :easy_jump
5
- bindkey "VC , m f", [:find_macro_gui, proc{$macro.find_macro_gui}, "Find named macro"]
6
- bindkey "C , m n", [:gui_name_macro, proc{$macro.gui_name_macro}, "Name last macro"]
4
+ bindkey "VC , m f", [:find_macro_gui, proc { $macro.find_macro_gui }, "Find named macro"]
5
+ bindkey "C , m n", [:gui_name_macro, proc { $macro.gui_name_macro }, "Name last macro"]
7
6
  bindkey "C , j r", :jump_to_random
8
7
  bindkey "I enter", :insert_new_line
9
8
  bindkey "C , ; s k", :show_key_bindings #TODO: better binding
@@ -30,13 +29,13 @@ bindkey "C , t 4", :set_line_style_h4
30
29
  bindkey "C , t b", :set_line_style_bold
31
30
  bindkey "C , t t", :set_line_style_title
32
31
  bindkey "C , t c", :clear_line_styles
33
- bindkey "C , b", :gui_select_buffer
32
+ bindkey "C , b", :start_buf_manager
34
33
  # bindkey "C , f o", :open_file_dialog
35
34
  bindkey "CI ctrl-o", :open_file_dialog
36
35
  # bindkey "M enter", :minibuffer_end
37
36
  bindkey "C , a", :ack_search
38
- bindkey "C d w", :delete_to_word_end
39
- bindkey "C d 0", :delete_to_line_start
37
+ bindkey "C d w", :delete_to_word_end
38
+ bindkey "C d 0", :delete_to_line_start
40
39
  bindkey "C , , f", :file_finder
41
40
  bindkey "VC h", :e_move_backward_char
42
41
  bindkey "C , , .", :backup_all_buffers
@@ -62,11 +61,11 @@ bindkey "C , g", :invoke_grep_search
62
61
  bindkey "C , v", :auto_indent_buffer
63
62
  bindkey "C , , d", :savedebug
64
63
  bindkey "C , , u", :update_file_index
65
- bindkey "C , s a", :buf_save_as
66
- bindkey "C d d", [:delete_line, proc{buf.delete_line}, "Delete current line"]
67
- bindkey "C enter || C return", [:line_action,proc{buf.handle_line_action()}, "Line action"]
68
- bindkey "C p" , [:paste_after,proc{buf.paste(AFTER)},""] # TODO: implement as replace for visual mode
69
- bindkey "V d" , [:delete_selection,proc{buf.delete(SELECTION)},""]
64
+ bindkey "C , s a", :buf_save_as
65
+ bindkey "C d d", [:delete_line, proc { buf.delete_line }, "Delete current line"]
66
+ bindkey "C enter || C return", [:line_action, proc { buf.handle_line_action() }, "Line action"]
67
+ bindkey "C p", [:paste_after, proc { buf.paste(AFTER) }, ""] # TODO: implement as replace for visual mode
68
+ bindkey "V d", [:delete_selection, proc { buf.delete(SELECTION) }, ""]
70
69
 
71
70
  default_keys = {
72
71
 
@@ -84,7 +83,6 @@ default_keys = {
84
83
  # "C , , ." => "backup_all_buffers()",
85
84
  "VC , , s" => :search_actions,
86
85
 
87
-
88
86
  # MOVING
89
87
  # 'VC h' => 'buf.move(BACKWARD_CHAR)',
90
88
  "VC l" => "buf.move(FORWARD_CHAR)",
@@ -107,7 +105,7 @@ default_keys = {
107
105
  "VC F <char>" => "buf.jump_to_next_instance_of_char(<char>,BACKWARD)",
108
106
  "VC f space" => "buf.jump_to_next_instance_of_char(' ')",
109
107
  "VC F space" => "buf.jump_to_next_instance_of_char(' ',BACKWARD)",
110
-
108
+
111
109
  "VC /[1-9]/" => "set_next_command_count(<char>)",
112
110
  # 'VC number=/[0-9]/+ g'=> 'jump_to_line(<number>)',
113
111
  # 'VC X=/[0-9]/+ * Y=/[0-9]/+ '=> 'x_times_y(<X>,<Y>)',
@@ -133,6 +131,9 @@ default_keys = {
133
131
  "C n" => "$search.jump_to_next()",
134
132
  "C N" => "$search.jump_to_previous()",
135
133
 
134
+
135
+ "C C" => :content_search,
136
+
136
137
  # Debug
137
138
  "C , d r p" => "start_ripl",
138
139
  "C , D" => "debug_print_buffer",
@@ -191,11 +192,14 @@ default_keys = {
191
192
  "V ctrl!" => "buf.end_visual_mode",
192
193
  "V y" => "buf.copy_active_selection()",
193
194
  "V a y" => "buf.copy_active_selection(:append)",
194
- "V g U" => "buf.transform_selection(:upcase)",
195
- "V g u" => "buf.transform_selection(:downcase)",
196
- "V g c" => "buf.transform_selection(:capitalize)",
197
- "V g s" => "buf.transform_selection(:swapcase)",
198
- "V g r" => "buf.transform_selection(:reverse)",
195
+ "V g U" => :selection_upcase,
196
+ "V g u" => :selection_downcase,
197
+ "V g c" => :selection_capitalize,
198
+ "V g s" => :selection_swapcase,
199
+ "V g r" => :selection_reverse,
200
+
201
+ "VC j" => :forward_line,
202
+ "VC k" => :backward_line,
199
203
 
200
204
  "V x" => "buf.delete(SELECTION)",
201
205
  # "V ctrl-c" => "buf.comment_selection",
@@ -215,15 +219,15 @@ default_keys = {
215
219
  # Macros
216
220
  # (experimental, may not work correctly)
217
221
  # "C q a" => '$macro.start_recording("a")',
218
- "VC q <char>" => '$macro.start_recording(<char>)',
222
+ "VC q <char>" => "$macro.start_recording(<char>)",
219
223
  "VC q($macro.is_recording==true) " => "$macro.end_recording", # TODO
220
224
  # 'C q'=> '$macro.end_recording', #TODO
221
225
  "C q v" => "$macro.end_recording",
222
226
  # 'C v'=> '$macro.end_recording',
223
227
  # "C M" => '$macro.run_last_macro',
224
- "C @ <char>" => '$macro.run_macro(<char>)',
228
+ "C @ <char>" => "$macro.run_macro(<char>)",
225
229
  "C , m S" => '$macro.save_macro("a")',
226
- "C , m s" => '$macro.save',
230
+ "C , m s" => "$macro.save",
227
231
  "C , t r" => "run_tests()",
228
232
 
229
233
  # "C ." => "repeat_last_action", # TODO
@@ -256,5 +260,3 @@ default_keys = {
256
260
  default_keys.each { |key, value|
257
261
  bindkey(key, value)
258
262
  }
259
-
260
-
data/lib/vimamsa/macro.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  def gui_find_macro_update_callback(search_str = "")
3
- puts "gui_find_macro_update_callback: #{search_str}"
3
+ debug "gui_find_macro_update_callback: #{search_str}"
4
4
  heystack = $macro.named_macros
5
5
  return [] if heystack.empty?
6
6
  $macro_search_list = []
@@ -14,10 +14,10 @@ def gui_find_macro_update_callback(search_str = "")
14
14
  end
15
15
 
16
16
  def gui_find_macro_select_callback(search_str, idx)
17
- puts "gui_find_macro_select_callback"
17
+ debug "gui_find_macro_select_callback"
18
18
  selected = $macro_search_list[idx]
19
19
  m = $macro.named_macros[selected[0]].clone
20
- puts "SELECTED MACRO:#{selected}, #{m}"
20
+ debug "SELECTED MACRO:#{selected}, #{m}"
21
21
  id = $macro.last_macro
22
22
  $macro.recorded_macros[id] = m
23
23
  $macro.run_macro(id)
@@ -64,7 +64,7 @@ class Macro
64
64
  end
65
65
 
66
66
  def name_macro(name, id = nil)
67
- puts "NAME MACRO #{name}"
67
+ debug "NAME MACRO #{name}"
68
68
  if id.nil?
69
69
  id = @last_macro
70
70
  end
@@ -134,7 +134,7 @@ class Macro
134
134
  # Ripl.start :binding => binding
135
135
  for a in acts
136
136
  ret = exec_action(a)
137
- puts ret
137
+ debug ret
138
138
  if ret == false
139
139
  message("Error while running macro")
140
140
  break
data/lib/vimamsa/main.rb CHANGED
@@ -37,15 +37,15 @@ $experimental = false
37
37
 
38
38
  # Return currently active buffer
39
39
  def buf()
40
- return $buffer
40
+ return vma.buf
41
41
  end
42
42
 
43
43
  def bufs()
44
- return $buffers
44
+ return vma.buffers
45
45
  end
46
46
 
47
47
  def buflist()
48
- return $buffers
48
+ return vma.buffers
49
49
  end
50
50
 
51
51
  require "vimamsa/editor.rb"
data/lib/vimamsa/rbvma.rb CHANGED
@@ -1,13 +1,15 @@
1
- require "gtk3"
2
- require "gtksourceview3"
3
1
  #require "gtksourceview4"
4
- require "ripl"
5
- require "fileutils"
6
- require "pathname"
7
2
  require "date"
8
- require "ripl/multi_line"
3
+ require "fileutils"
4
+ require "gtk3"
5
+ require "gtksourceview4"
9
6
  require "json"
10
7
  require "listen"
8
+ require "pathname"
9
+ require "ripl"
10
+ require "ripl/multi_line"
11
+ require "shellwords"
12
+ require "cgi"
11
13
 
12
14
  require "vimamsa/util"
13
15
  require "vimamsa/main"
@@ -16,27 +18,29 @@ require "vimamsa/actions"
16
18
  require "vimamsa/key_binding_tree"
17
19
  require "vimamsa/key_actions"
18
20
 
19
-
21
+ # Graphical stuff:
20
22
  require "vimamsa/gui"
21
23
  require "vimamsa/gui_menu"
22
24
  require "vimamsa/gui_select_window"
23
25
  require "vimamsa/gui_sourceview"
26
+ require "vimamsa/gui_image"
27
+ require "vimamsa/hyper_plain_text"
24
28
 
25
- require "vimamsa/macro"
29
+ require "vimamsa/ack"
26
30
  require "vimamsa/buffer"
27
- require "vimamsa/debug"
31
+ require "vimamsa/buffer_list"
32
+ require "vimamsa/buffer_manager"
28
33
  require "vimamsa/constants"
34
+ require "vimamsa/debug"
29
35
  require "vimamsa/easy_jump"
36
+ require "vimamsa/encrypt"
37
+ require "vimamsa/file_finder"
38
+ require "vimamsa/file_manager"
30
39
  require "vimamsa/hook"
40
+ require "vimamsa/macro"
31
41
  require "vimamsa/search"
32
42
  require "vimamsa/search_replace"
33
- require "vimamsa/buffer_list"
34
- require "vimamsa/file_finder"
35
- require "vimamsa/hyper_plain_text"
36
- require "vimamsa/ack"
37
- require "vimamsa/encrypt"
38
- require "vimamsa/file_manager"
39
-
43
+ require "vimamsa/conf"
40
44
  # load "vendor/ver/lib/ver/vendor/textpow.rb"
41
45
  # load "vendor/ver/lib/ver/syntax/detector.rb"
42
46
  # load "vendor/ver/config/detect.rb"
@@ -48,7 +52,7 @@ def vma()
48
52
  end
49
53
 
50
54
  def unimplemented
51
- puts "unimplemented"
55
+ debug "unimplemented"
52
56
  end
53
57
 
54
58
 
@@ -56,7 +60,7 @@ $debug = false
56
60
 
57
61
  def scan_indexes(txt, regex)
58
62
  # indexes = txt.enum_for(:scan, regex).map { Regexp.last_match.begin(0) + 1 }
59
- indexes = txt.enum_for(:scan, regex).map { Regexp.last_match.begin(0) }
63
+ indexes = txt.enum_for(:scan, regex).map { Regexp.last_match.begin(0) }
60
64
  return indexes
61
65
  end
62
66
 
@@ -3,7 +3,7 @@ def execute_search(input_str)
3
3
  $search = Search.new
4
4
  eval_str="execute_search(#{input_str.dump})"
5
5
  $macro.overwrite_current_action(eval_str)
6
- return $search.set(input_str, "simple", $buffer)
6
+ return $search.set(input_str, "simple", vma.buf)
7
7
  end
8
8
 
9
9
  def invoke_search()
@@ -32,7 +32,7 @@ class Search
32
32
  @reg = Regexp.new(regex, Regexp::IGNORECASE)
33
33
  end
34
34
  @search_indexes = scan_indexes(buffer, @reg)
35
- puts @search_indexes.inspect
35
+ debug @search_indexes.inspect
36
36
  @cur_search_i = -1
37
37
  if @search_indexes.any?
38
38
  @cur_search_i = 0