vimamsa 0.1.4 → 0.1.7
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.
- checksums.yaml +4 -4
- data/exe/vimamsa +30 -22
- data/ext/vmaext/vmaext.c +0 -3
- data/lib/vimamsa/ack.rb +0 -4
- data/lib/vimamsa/actions.rb +20 -32
- data/lib/vimamsa/buffer.rb +113 -57
- data/lib/vimamsa/buffer_list.rb +4 -4
- data/lib/vimamsa/debug.rb +6 -6
- data/lib/vimamsa/easy_jump.rb +129 -125
- data/lib/vimamsa/editor.rb +64 -31
- data/lib/vimamsa/file_finder.rb +2 -2
- data/lib/vimamsa/file_history.rb +12 -5
- data/lib/vimamsa/gui.rb +562 -0
- data/lib/vimamsa/gui_gtk_sourceview.rb +294 -0
- data/lib/vimamsa/gui_menu.rb +100 -0
- data/lib/vimamsa/gui_select_window.rb +177 -0
- data/lib/vimamsa/gui_sourceview.rb +294 -0
- data/lib/vimamsa/{default_key_bindings.rb → key_actions.rb} +71 -191
- data/lib/vimamsa/key_binding_tree.rb +21 -9
- data/lib/vimamsa/key_bindings_vimlike.rb +260 -0
- data/lib/vimamsa/macro.rb +1 -1
- data/lib/vimamsa/main.rb +1 -2
- data/lib/vimamsa/rbvma.rb +17 -965
- data/lib/vimamsa/search.rb +0 -4
- data/lib/vimamsa/search_replace.rb +1 -2
- data/lib/vimamsa/util.rb +1 -1
- data/lib/vimamsa/version.rb +1 -1
- data/lib/vimamsa.rb +1 -31
- data/vimamsa.gemspec +2 -1
- metadata +25 -5
data/lib/vimamsa/easy_jump.rb
CHANGED
@@ -1,161 +1,165 @@
|
|
1
|
-
|
2
1
|
# Similar feature as Vim EasyMotion https://github.com/easymotion/vim-easymotion
|
3
2
|
class EasyJump
|
4
|
-
def initialize()
|
5
|
-
|
3
|
+
# def self.initialize()
|
4
|
+
# make_jump_sequence
|
5
|
+
# end
|
6
|
+
|
7
|
+
def self.start()
|
8
|
+
@@cur = EasyJump.new
|
6
9
|
end
|
7
|
-
end
|
8
10
|
|
9
|
-
def
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
$jump_sequence = make_jump_sequence($easy_jump_wsmarks.size)
|
33
|
-
|
34
|
-
$input_char_call_func = method(:easy_jump_input_char)
|
35
|
-
$kbd.set_mode(:readchar)
|
36
|
-
$easy_jump_input = ""
|
37
|
-
easy_jump_draw
|
38
|
-
end
|
11
|
+
def initialize()
|
12
|
+
# message "EASY JUMP"
|
13
|
+
visible_range = get_visible_area()
|
14
|
+
visible_text = buf[visible_range[0]..visible_range[1]]
|
15
|
+
wsmarks = scan_word_start_marks(visible_text)
|
16
|
+
line_starts = scan_indexes(visible_text, /^/)
|
17
|
+
lsh = Hash[line_starts.collect { |x| [x, true] }]
|
18
|
+
wsmh = Hash[wsmarks.collect { |x| [x, true] }]
|
19
|
+
|
20
|
+
wsmarks.select! { |x|
|
21
|
+
r = true
|
22
|
+
r = false if lsh[x] or lsh[x - 1] or lsh[x - 2]
|
23
|
+
r
|
24
|
+
}
|
25
|
+
|
26
|
+
linestart_buf = (line_starts).collect { |x| x + visible_range[0] }
|
27
|
+
wsmarks_buf = (wsmarks).collect { |x| x + visible_range[0] }
|
28
|
+
|
29
|
+
# All line starts should be accessible with just two key presses, so put them first in order
|
30
|
+
# Other word start positions ordered by distance from current pos
|
31
|
+
wsmarks_buf.sort_by! { |x| (x - buf.pos).abs }
|
32
|
+
@easy_jump_wsmarks = linestart_buf + wsmarks_buf
|
39
33
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
jshash = Hash[$jump_sequence.map.with_index.to_a]
|
46
|
-
nthword = jshash[$easy_jump_input]
|
47
|
-
puts "nthword:#{nthword} #{[$easy_jump_wsmarks[nthword],$jump_sequence[nthword]]}"
|
48
|
-
$buffer.set_pos($easy_jump_wsmarks[nthword])
|
49
|
-
$kbd.set_mode(:command)
|
50
|
-
$input_char_call_func = nil
|
51
|
-
$jump_sequence = []
|
52
|
-
$vmag.clear_overlay()
|
34
|
+
@jump_sequence = make_jump_sequence(@easy_jump_wsmarks.size)
|
35
|
+
|
36
|
+
vma.kbd.set_keyhandling_override(self.method(:easy_jump_input_char))
|
37
|
+
@easy_jump_input = ""
|
38
|
+
easy_jump_draw
|
53
39
|
end
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
40
|
+
|
41
|
+
def easy_jump_input_char(c, event_type)
|
42
|
+
return true if event_type != :key_press
|
43
|
+
# vma.paint_stack = []
|
44
|
+
puts "EASY JUMP: easy_jump_input_char [#{c}]"
|
45
|
+
@easy_jump_input << c.upcase
|
46
|
+
if @jump_sequence.include?(@easy_jump_input)
|
47
|
+
jshash = Hash[@jump_sequence.map.with_index.to_a]
|
48
|
+
nthword = jshash[@easy_jump_input]
|
49
|
+
puts "nthword:#{nthword} #{[@easy_jump_wsmarks[nthword], @jump_sequence[nthword]]}"
|
50
|
+
buf.set_pos(@easy_jump_wsmarks[nthword])
|
51
|
+
# @kbd.set_mode(:command)
|
52
|
+
vma.kbd.remove_keyhandling_override
|
53
|
+
@jump_sequence = []
|
54
|
+
vma.gui.clear_overlay()
|
55
|
+
end
|
56
|
+
if @easy_jump_input.size > 2
|
57
|
+
# @kbd.set_mode(:command)
|
58
|
+
vma.kbd.remove_keyhandling_override
|
59
|
+
@jump_sequence = []
|
60
|
+
vma.gui.clear_overlay()
|
61
|
+
end
|
62
|
+
return true
|
59
63
|
end
|
60
|
-
end
|
61
64
|
|
62
|
-
def easy_jump_draw()
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
def easy_jump_draw()
|
66
|
+
# puts @jump_sequence.inspect
|
67
|
+
# puts @easy_jump_wsmarks.inspect
|
68
|
+
vma.gui.start_overlay_draw
|
69
|
+
for i in 0..(@easy_jump_wsmarks.size - 1)
|
70
|
+
vma.gui.overlay_draw_text(@jump_sequence[i], @easy_jump_wsmarks[i])
|
71
|
+
end
|
72
|
+
vma.gui.end_overlay_draw
|
73
|
+
|
74
|
+
return
|
75
|
+
return if @jump_sequence.empty?
|
76
|
+
puts "EASY JUMP DRAW"
|
77
|
+
screen_cord = cpp_function_wrapper(0, [@easy_jump_wsmarks])
|
78
|
+
screen_cord = screen_cord[1..@jump_sequence.size]
|
79
|
+
screen_cord.each_with_index { |point, i|
|
80
|
+
mark_str = @jump_sequence[i]
|
81
|
+
#puts "draw #{point[0]}x#{point[1]}"
|
82
|
+
draw_text(mark_str, point[0] + 3, point[1])
|
83
|
+
#break if m > @cpos
|
84
|
+
}
|
68
85
|
end
|
69
|
-
$vmag.end_overlay_draw
|
70
|
-
|
71
|
-
return
|
72
|
-
return if $jump_sequence.empty?
|
73
|
-
puts "EASY JUMP DRAW"
|
74
|
-
screen_cord = cpp_function_wrapper(0, [$easy_jump_wsmarks])
|
75
|
-
screen_cord = screen_cord[1..$jump_sequence.size]
|
76
|
-
screen_cord.each_with_index { |point, i|
|
77
|
-
mark_str = $jump_sequence[i]
|
78
|
-
#puts "draw #{point[0]}x#{point[1]}"
|
79
|
-
draw_text(mark_str, point[0] + 3, point[1])
|
80
|
-
#break if m > $cpos
|
81
|
-
}
|
82
|
-
end
|
83
86
|
|
84
|
-
def make_jump_sequence(num_items)
|
85
|
-
|
86
|
-
|
87
|
+
def make_jump_sequence(num_items)
|
88
|
+
left_hand = "asdfvgbqwertzxc123".upcase.split("")
|
89
|
+
right_hand = "jklhnnmyuiop890".upcase.split("")
|
87
90
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
+
sequence = []
|
92
|
+
left_hand_fast = "asdf".upcase.split("")
|
93
|
+
right_hand_fast = "jkl;".upcase.split("")
|
91
94
|
|
92
|
-
|
93
|
-
|
95
|
+
left_hand_slow = "wergc".upcase.split("") # v
|
96
|
+
right_hand_slow = "uiophnm,".upcase.split("")
|
94
97
|
|
95
|
-
|
96
|
-
|
98
|
+
left_hand_slow2 = "tzx23".upcase.split("")
|
99
|
+
right_hand_slow2 = "yb9'".upcase.split("")
|
97
100
|
|
98
|
-
|
101
|
+
# Rmoved characters that can be mixed: O0Q, 8B, I1, VY
|
99
102
|
|
100
|
-
|
101
|
-
|
103
|
+
left_fast_slow = Array.new(left_hand_fast).concat(left_hand_slow)
|
104
|
+
right_fast_slow = Array.new(right_hand_fast).concat(right_hand_slow)
|
102
105
|
|
103
|
-
|
104
|
-
|
106
|
+
left_hand_all = Array.new(left_hand_fast).concat(left_hand_slow).concat(left_hand_slow2)
|
107
|
+
right_hand_all = Array.new(right_hand_fast).concat(right_hand_slow).concat(right_hand_slow2)
|
105
108
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
+
left_hand_fast.each { |x|
|
110
|
+
left_hand_fast.each { |y|
|
111
|
+
sequence << "#{x}#{y}"
|
112
|
+
}
|
109
113
|
}
|
110
|
-
}
|
111
114
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
+
right_hand_fast.each { |x|
|
116
|
+
right_hand_fast.each { |y|
|
117
|
+
sequence << "#{x}#{y}"
|
118
|
+
}
|
115
119
|
}
|
116
|
-
}
|
117
120
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
+
right_hand_fast.each { |x|
|
122
|
+
left_hand_fast.each { |y|
|
123
|
+
sequence << "#{x}#{y}"
|
124
|
+
}
|
121
125
|
}
|
122
|
-
}
|
123
126
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
+
left_hand_fast.each { |x|
|
128
|
+
right_hand_fast.each { |y|
|
129
|
+
sequence << "#{x}#{y}"
|
130
|
+
}
|
127
131
|
}
|
128
|
-
}
|
129
132
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
+
left_hand_slow.each { |x|
|
134
|
+
right_fast_slow.each { |y|
|
135
|
+
sequence << "#{x}#{y}"
|
136
|
+
}
|
133
137
|
}
|
134
|
-
}
|
135
138
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
+
right_hand_slow.each { |x|
|
140
|
+
left_fast_slow.each { |y|
|
141
|
+
sequence << "#{x}#{y}"
|
142
|
+
}
|
139
143
|
}
|
140
|
-
}
|
141
144
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
145
|
+
left_hand_slow2.each { |x|
|
146
|
+
right_hand_all.each { |y|
|
147
|
+
left_hand_all.each { |z|
|
148
|
+
sequence << "#{x}#{y}#{z}"
|
149
|
+
}
|
146
150
|
}
|
147
151
|
}
|
148
|
-
}
|
149
152
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
153
|
+
right_hand_slow2.each { |x|
|
154
|
+
left_hand_all.each { |y|
|
155
|
+
right_hand_all.each { |z|
|
156
|
+
sequence << "#{x}#{y}#{z}"
|
157
|
+
}
|
154
158
|
}
|
155
159
|
}
|
156
|
-
}
|
157
160
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
+
#printf("Size of sequence: %d\n",sequence.size)
|
162
|
+
#puts sequence.inspect
|
163
|
+
return sequence
|
164
|
+
end
|
161
165
|
end
|
data/lib/vimamsa/editor.rb
CHANGED
@@ -1,16 +1,23 @@
|
|
1
1
|
require "pty"
|
2
2
|
|
3
|
-
def exec_in_terminal(cmd)
|
3
|
+
def exec_in_terminal(cmd, autoclose = false)
|
4
4
|
# puts "CMD:#{cmd}"
|
5
5
|
|
6
6
|
# global to prevent garbage collect unlink
|
7
7
|
$initf = Tempfile.new("bashinit")
|
8
8
|
# puts $initf.path
|
9
9
|
$initf.write(cmd)
|
10
|
-
|
11
|
-
|
10
|
+
if autoclose
|
11
|
+
$initf.write("\nsleep 10; exit;\n")
|
12
|
+
$initf.write("rm #{$initf.path}\n")
|
13
|
+
else
|
14
|
+
$initf.write("rm #{$initf.path}\n")
|
15
|
+
$initf.write("\nexec bash\n")
|
16
|
+
end
|
12
17
|
$initf.close
|
13
18
|
# PTY.spawn("gnome-terminal", "--tab", "--", "bash", "-i", $initf.path, "-c", "exec bash")
|
19
|
+
# fork { exec "gnome-terminal", "--tab", "--", "bash", "-i", $initf.path, "-c", "exec bash" }
|
20
|
+
# Just another execution
|
14
21
|
fork { exec "gnome-terminal", "--tab", "--", "bash", "-i", $initf.path, "-c", "exec bash" }
|
15
22
|
end
|
16
23
|
|
@@ -19,9 +26,14 @@ def handle_drag_and_drop(fname)
|
|
19
26
|
buf.handle_drag_and_drop(fname)
|
20
27
|
end
|
21
28
|
|
29
|
+
def mkdir_if_not_exists(_dirpath)
|
30
|
+
dirpath = File.expand_path(_dirpath)
|
31
|
+
Dir.mkdir(dirpath) unless File.exist?(dirpath)
|
32
|
+
end
|
33
|
+
|
22
34
|
class Editor
|
23
|
-
attr_reader :file_content_search_paths, :file_name_search_paths
|
24
|
-
attr_accessor :converters, :fh, :paint_stack
|
35
|
+
attr_reader :file_content_search_paths, :file_name_search_paths, :gui
|
36
|
+
attr_accessor :converters, :fh, :paint_stack, :kbd
|
25
37
|
#attr_writer :call_func, :update_highlight
|
26
38
|
|
27
39
|
def initialize()
|
@@ -39,6 +51,24 @@ class Editor
|
|
39
51
|
@_plugins = {}
|
40
52
|
end
|
41
53
|
|
54
|
+
def open_file_listener(added)
|
55
|
+
if !added.empty?
|
56
|
+
for fp in added
|
57
|
+
sleep 0.1
|
58
|
+
x = IO.read(fp)
|
59
|
+
File.delete(fp)
|
60
|
+
for f in x.lines
|
61
|
+
f.gsub!("\n", "")
|
62
|
+
if File.exist?(f)
|
63
|
+
if file_is_text_file(f)
|
64
|
+
jump_to_file(f)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
42
72
|
def start
|
43
73
|
# $highlight = {}
|
44
74
|
|
@@ -47,6 +77,8 @@ class Editor
|
|
47
77
|
# GLib::Idle.add(proc{ puts "IDLEFUNC"})
|
48
78
|
# GLib::Idle.add(proc { idle_func })
|
49
79
|
|
80
|
+
@gui = $vmag #TODO
|
81
|
+
|
50
82
|
$hook = Hook.new
|
51
83
|
register_plugin(:Hook, $hook)
|
52
84
|
$macro = Macro.new
|
@@ -61,7 +93,8 @@ class Editor
|
|
61
93
|
|
62
94
|
debug "ARGV: " + ARGV.inspect
|
63
95
|
# build_key_bindings_tree
|
64
|
-
|
96
|
+
@kbd = KeyBindingTree.new()
|
97
|
+
$kbd = @kbd
|
65
98
|
$kbd.add_mode("C", :command)
|
66
99
|
$kbd.add_mode("I", :insert)
|
67
100
|
$kbd.add_mode("V", :visual)
|
@@ -69,13 +102,20 @@ class Editor
|
|
69
102
|
$kbd.add_mode("R", :readchar)
|
70
103
|
$kbd.add_mode("B", :browse)
|
71
104
|
$kbd.set_default_mode(:command)
|
72
|
-
require "vimamsa/
|
105
|
+
require "vimamsa/key_bindings_vimlike"
|
73
106
|
sleep(0.03)
|
74
107
|
|
75
108
|
FileManager.init
|
76
109
|
|
77
|
-
|
78
|
-
|
110
|
+
mkdir_if_not_exists("~/.vimamsa")
|
111
|
+
mkdir_if_not_exists("~/.vimamsa/backup")
|
112
|
+
mkdir_if_not_exists("~/.vimamsa/listen")
|
113
|
+
listen_dir = File.expand_path "~/.vimamsa/listen"
|
114
|
+
listener = Listen.to(listen_dir) do |modified, added, removed|
|
115
|
+
puts(modified: modified, added: added, removed: removed)
|
116
|
+
open_file_listener(added)
|
117
|
+
end
|
118
|
+
listener.start
|
79
119
|
|
80
120
|
$cnf[:theme] = "Twilight_edit"
|
81
121
|
$cnf[:syntax_highlight] = true
|
@@ -84,7 +124,7 @@ class Editor
|
|
84
124
|
$cnf = eval(IO.read(settings_path))
|
85
125
|
end
|
86
126
|
|
87
|
-
#
|
127
|
+
# set_gui_style(1)
|
88
128
|
|
89
129
|
# Limit file search to these extensions:
|
90
130
|
$find_extensions = [".txt", ".h", ".c", ".cpp", ".hpp", ".rb"]
|
@@ -114,7 +154,7 @@ class Editor
|
|
114
154
|
if fname
|
115
155
|
buffer = Buffer.new(read_file("", fname), fname)
|
116
156
|
else
|
117
|
-
buffer = Buffer.new("
|
157
|
+
buffer = Buffer.new(" \n")
|
118
158
|
end
|
119
159
|
$buffers << buffer
|
120
160
|
|
@@ -203,8 +243,7 @@ class Editor
|
|
203
243
|
# Register converter
|
204
244
|
def reg_conv(converter, converter_id)
|
205
245
|
@converters[converter_id] = converter
|
206
|
-
reg_act(converter_id, proc { $buffer.convert_selected_text(converter_id) }, "Converter #{converter_id}", [:selection])
|
207
|
-
# reg_act(converter_id, "$buffer.convert_selected_text(:#{converter_id})", "Converter #{converter_id}", [:selection])
|
246
|
+
reg_act(converter_id, proc { $buffer.convert_selected_text(converter_id) }, "Converter #{converter_id}", { :scope => [:selection] })
|
208
247
|
end
|
209
248
|
|
210
249
|
def apply_conv(converter_id, txt)
|
@@ -231,10 +270,8 @@ class Editor
|
|
231
270
|
end
|
232
271
|
|
233
272
|
def _quit()
|
234
|
-
# Shut down the Qt thread before the ruby thread
|
235
273
|
vma.shutdown
|
236
|
-
|
237
|
-
exit
|
274
|
+
Gtk.main_quit
|
238
275
|
end
|
239
276
|
|
240
277
|
def fatal_error(msg)
|
@@ -243,14 +280,13 @@ def fatal_error(msg)
|
|
243
280
|
end
|
244
281
|
|
245
282
|
def file_saveas(filename)
|
246
|
-
|
247
|
-
$buffer.save()
|
283
|
+
buf.save_as_callback(filename)
|
248
284
|
end
|
249
285
|
|
250
286
|
def open_file_dialog()
|
251
287
|
path = ""
|
252
288
|
path = $buffer.fname if $buffer.fname
|
253
|
-
|
289
|
+
gui_open_file_dialog(File.dirname(path))
|
254
290
|
end
|
255
291
|
|
256
292
|
def system_clipboard_changed(clipboard_contents)
|
@@ -264,6 +300,10 @@ def system_clipboard_changed(clipboard_contents)
|
|
264
300
|
$clipboard = $clipboard[-([$clipboard.size, max_clipboard_items].min)..-1]
|
265
301
|
end
|
266
302
|
|
303
|
+
def get_clipboard()
|
304
|
+
return $clipboard[-1]
|
305
|
+
end
|
306
|
+
|
267
307
|
def set_clipboard(s)
|
268
308
|
if !(s.class <= String) or s.size == 0
|
269
309
|
puts s.inspect
|
@@ -384,9 +424,9 @@ def minibuffer_new_char(c)
|
|
384
424
|
#$buffer = $minibuffer
|
385
425
|
end
|
386
426
|
|
387
|
-
def readchar_new_char(c)
|
388
|
-
|
389
|
-
end
|
427
|
+
# def readchar_new_char(c)
|
428
|
+
# $input_char_call_func.call(c)
|
429
|
+
# end
|
390
430
|
|
391
431
|
def minibuffer_delete()
|
392
432
|
$minibuffer.delete(BACKWARD_CHAR)
|
@@ -432,7 +472,7 @@ GUESS_ENCODING_ORDER = [
|
|
432
472
|
def create_new_file(filename = nil, file_contents = "\n")
|
433
473
|
debug "NEW FILE CREATED"
|
434
474
|
buffer = Buffer.new(file_contents)
|
435
|
-
|
475
|
+
# gui_set_current_buffer(buffer.id) #TODO: remove?
|
436
476
|
$buffers << buffer
|
437
477
|
return buffer
|
438
478
|
end
|
@@ -458,7 +498,7 @@ def load_buffer(fname)
|
|
458
498
|
end
|
459
499
|
debug("LOAD BUFFER: #{fname}")
|
460
500
|
buffer = Buffer.new(read_file("", fname), fname)
|
461
|
-
#
|
501
|
+
# gui_set_current_buffer(buffer.id)
|
462
502
|
buffer.set_active
|
463
503
|
debug("DONE LOAD: #{fname}")
|
464
504
|
#buf = filter_buffer(buffer)
|
@@ -493,7 +533,6 @@ def open_new_file(filename, file_contents = "")
|
|
493
533
|
fname = filename
|
494
534
|
load_buffer(fname)
|
495
535
|
end
|
496
|
-
set_window_title("Vimamsa - #{File.basename(filename)}")
|
497
536
|
end
|
498
537
|
|
499
538
|
def scan_word_start_marks(search_str)
|
@@ -506,10 +545,6 @@ def draw_text(str, x, y)
|
|
506
545
|
vma.paint_stack << [4, x, y, str]
|
507
546
|
end
|
508
547
|
|
509
|
-
def center_on_current_line__2del()
|
510
|
-
center_where_cursor
|
511
|
-
end
|
512
|
-
|
513
548
|
def hook_draw()
|
514
549
|
# TODO: as hook.register
|
515
550
|
# easy_jump_draw()
|
@@ -527,8 +562,6 @@ def render_buffer(buffer = 0, reset = 0)
|
|
527
562
|
t1 = Time.now
|
528
563
|
hook_draw()
|
529
564
|
|
530
|
-
render_text(tmpbuf, pos, selection_start, reset) #TODO: remove?
|
531
|
-
|
532
565
|
if $buffer.need_redraw?
|
533
566
|
hpt_scan_images() if $debug #experimental
|
534
567
|
end
|
data/lib/vimamsa/file_finder.rb
CHANGED
@@ -21,7 +21,7 @@ class FileFinder
|
|
21
21
|
Thread.new { recursively_find_files() }
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
gui_select_update_window(l, $select_keys.collect { |x| x.upcase },
|
25
25
|
"gui_file_finder_select_callback",
|
26
26
|
"gui_file_finder_update_callback")
|
27
27
|
end
|
@@ -83,7 +83,7 @@ end
|
|
83
83
|
def gui_file_finder_select_callback(search_str, idx)
|
84
84
|
selected_file = $file_search_list[idx][0]
|
85
85
|
debug "FILE FINDER SELECT CALLBACK: s=#{search_str},i=#{idx}: #{selected_file}"
|
86
|
-
|
86
|
+
gui_select_window_close(0)
|
87
87
|
open_new_file(selected_file)
|
88
88
|
end
|
89
89
|
|
data/lib/vimamsa/file_history.rb
CHANGED
@@ -55,9 +55,14 @@ class FileHistory
|
|
55
55
|
l = []
|
56
56
|
$select_keys = ["h", "l", "f", "d", "s", "a", "g", "z"]
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
opt = { :title => "File history search",
|
59
|
+
:desc => "Search for previously opened files. Fuzzy search." ,
|
60
|
+
:columns => [{:title=>'Filename',:id=>0}]
|
61
|
+
}
|
62
|
+
gui_select_update_window(l, $select_keys.collect { |x| x.upcase },
|
63
|
+
"gui_file_history_select_callback",
|
64
|
+
"gui_file_history_update_callback",
|
65
|
+
opt)
|
61
66
|
end
|
62
67
|
end
|
63
68
|
|
@@ -86,8 +91,10 @@ def gui_file_history_update_callback(search_str = "")
|
|
86
91
|
if (search_str.size > 1)
|
87
92
|
files = fuzzy_filter(search_str, $vma.fh.history.keys, 40)
|
88
93
|
end
|
94
|
+
|
89
95
|
$search_list = files
|
90
|
-
|
96
|
+
ret = files.collect{|x|[x[0]]}
|
97
|
+
return ret
|
91
98
|
end
|
92
99
|
|
93
100
|
def gui_file_history_select_callback(search_str, idx)
|
@@ -95,6 +102,6 @@ def gui_file_history_select_callback(search_str, idx)
|
|
95
102
|
selected_file = $search_list[idx][0]
|
96
103
|
|
97
104
|
debug "FILE HISTORY SELECT CALLBACK: s=#{search_str},i=#{idx}: #{selected_file}"
|
98
|
-
|
105
|
+
gui_select_window_close(0)
|
99
106
|
open_new_file(selected_file)
|
100
107
|
end
|