vimamsa 0.1.5 → 0.1.6
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 +4 -2
- data/lib/vimamsa/ack.rb +0 -4
- data/lib/vimamsa/actions.rb +20 -32
- data/lib/vimamsa/buffer.rb +23 -16
- data/lib/vimamsa/buffer_list.rb +3 -3
- data/lib/vimamsa/debug.rb +6 -6
- data/lib/vimamsa/easy_jump.rb +129 -125
- data/lib/vimamsa/editor.rb +29 -28
- data/lib/vimamsa/file_finder.rb +2 -2
- data/lib/vimamsa/file_history.rb +12 -5
- data/lib/vimamsa/gui.rb +561 -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} +64 -189
- data/lib/vimamsa/key_binding_tree.rb +21 -9
- data/lib/vimamsa/key_bindings_vimlike.rb +259 -0
- data/lib/vimamsa/macro.rb +1 -1
- data/lib/vimamsa/main.rb +1 -2
- data/lib/vimamsa/rbvma.rb +16 -1023
- data/lib/vimamsa/search.rb +0 -4
- data/lib/vimamsa/search_replace.rb +1 -2
- data/lib/vimamsa/version.rb +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82ad35212b7d75bfd5b702943ff3ed3180f7f1bd0b3912840e9ecfdf6126e467
|
4
|
+
data.tar.gz: 8eff2ee35e1ecc2d791ff1fbf4a881e6aada9b38d35ce11e356b316b536bc642
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 440d5d3b5b537fc9d3848d0f187df77dd045cde34643db356cd88ae5591e4e8c1c8596aac50f170ef7124dbd8784deddaff2d436f46dac0a8a180ccfeae4a9aa
|
7
|
+
data.tar.gz: c058e9db468553e29f617186ea0d65d04014307b7797c5dad013b5b3738fab57c0f7a44e7401ae9606e88581ac4f557fad3665c6dc8f784781619a310c114b95
|
data/exe/vimamsa
CHANGED
@@ -16,7 +16,9 @@ listen_dir = File.expand_path("~/.vimamsa/listen")
|
|
16
16
|
if File.exist?(listen_dir) and !ARGV[0].nil?
|
17
17
|
tmpf = Tempfile.new("vmarun", listen_dir)
|
18
18
|
fp = tmpf.path
|
19
|
-
|
19
|
+
paramfn = File.expand_path(ARGV[0])
|
20
|
+
puts paramfn
|
21
|
+
tmpf.write(paramfn)
|
20
22
|
tmpf.close
|
21
23
|
tstart = Time.new
|
22
24
|
timeout = false
|
@@ -36,5 +38,5 @@ $LOAD_PATH.unshift(File.expand_path("ext"))
|
|
36
38
|
require "vimamsa"
|
37
39
|
# Ilib:ext
|
38
40
|
# r rbvma -e "puts VMA.new.run"
|
39
|
-
$vmag =
|
41
|
+
$vmag = VMAgui.new()
|
40
42
|
$vmag.run
|
data/lib/vimamsa/ack.rb
CHANGED
data/lib/vimamsa/actions.rb
CHANGED
@@ -1,73 +1,62 @@
|
|
1
1
|
class Action
|
2
|
-
attr_accessor :id, :method_name, :method
|
2
|
+
attr_accessor :id, :method_name, :method, :opt
|
3
3
|
|
4
|
-
def initialize(id, method_name, method,
|
4
|
+
def initialize(id, method_name, method, opt = {})
|
5
5
|
@method_name = method_name
|
6
6
|
@id = id
|
7
7
|
@method = method
|
8
|
+
@opt = opt
|
9
|
+
|
8
10
|
$actions[id] = self
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
12
14
|
$actions = {}
|
13
15
|
|
14
|
-
|
15
|
-
# if callfunc.class == Proc
|
16
|
-
# a = Action.new(id, name, callfunc, scope)
|
17
|
-
# else
|
18
|
-
# a = Action.new(id, name, method(callfunc), scope)
|
19
|
-
# end
|
20
|
-
# end
|
21
|
-
|
22
|
-
def reg_act(id, callfunc, name = "", scope = [])
|
16
|
+
def reg_act(id, callfunc, name = "", opt = {})
|
23
17
|
if callfunc.class == Proc
|
24
|
-
a = Action.new(id, name, callfunc,
|
18
|
+
a = Action.new(id, name, callfunc, opt)
|
25
19
|
else
|
26
20
|
begin
|
27
21
|
m = method(callfunc)
|
28
22
|
rescue NameError
|
29
23
|
m = method("missing_callfunc")
|
30
24
|
end
|
31
|
-
a = Action.new(id, name, m,
|
25
|
+
a = Action.new(id, name, m, opt)
|
32
26
|
end
|
27
|
+
return a
|
33
28
|
end
|
34
29
|
|
35
30
|
def missing_callfunc
|
36
31
|
puts "missing_callfunc"
|
37
32
|
end
|
38
33
|
|
39
|
-
|
34
|
+
#TODO: remove
|
40
35
|
def call(id)
|
36
|
+
call_action(id)
|
37
|
+
end
|
38
|
+
|
39
|
+
def call_action(id)
|
41
40
|
a = $actions[id]
|
42
41
|
if a
|
43
|
-
# Ripl.start :binding => binding
|
44
42
|
a.method.call()
|
43
|
+
else
|
44
|
+
message("Unknown action: " + id.inspect)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
def search_actions()
|
49
49
|
l = []
|
50
50
|
$select_keys = ["h", "l", "f", "d", "s", "a", "g", "z"]
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
gui_select_update_window(l, $select_keys.collect { |x| x.upcase },
|
52
|
+
"search_actions_select_callback",
|
53
|
+
"search_actions_update_callback")
|
54
54
|
end
|
55
55
|
|
56
56
|
$item_list = []
|
57
57
|
|
58
58
|
def search_actions_update_callback(search_str = "")
|
59
|
-
# item_list = $actions.collect {|x| x[1].id.to_s}
|
60
59
|
return [] if search_str == ""
|
61
|
-
# item_list = $action_list.collect { |x|
|
62
|
-
# actname = x[:action].to_s
|
63
|
-
# if x[:action].class == Symbol
|
64
|
-
# mn = $actions[x[:action]].method_name
|
65
|
-
# actname = mn if mn.size > 0
|
66
|
-
# end
|
67
|
-
# r = { :str => actname, :key => x[:key], :action => x[:action] }
|
68
|
-
# }
|
69
|
-
|
70
|
-
# => {:str=>"insert_new_line", :key=>"I return", :action=>:insert_new_line}
|
71
60
|
|
72
61
|
item_list2 = []
|
73
62
|
for act_id in $actions.keys
|
@@ -81,7 +70,7 @@ def search_actions_update_callback(search_str = "")
|
|
81
70
|
end
|
82
71
|
item_list2 << item
|
83
72
|
end
|
84
|
-
|
73
|
+
|
85
74
|
item_list = item_list2
|
86
75
|
|
87
76
|
a = filter_items(item_list, 0, search_str)
|
@@ -90,7 +79,6 @@ def search_actions_update_callback(search_str = "")
|
|
90
79
|
r = a.collect { |x| [x[0][0], 0, x] }
|
91
80
|
puts r.inspect
|
92
81
|
$item_list = r
|
93
|
-
# Ripl.start :binding => binding
|
94
82
|
|
95
83
|
r = a.collect { |x| ["[#{x[0][:key]}] #{x[0][:str]}", 0, x] }
|
96
84
|
return r
|
@@ -101,7 +89,7 @@ def search_actions_select_callback(search_str, idx)
|
|
101
89
|
acc = item[0][:action]
|
102
90
|
|
103
91
|
puts "Selected:" + acc.to_s
|
104
|
-
|
92
|
+
gui_select_window_close(0)
|
105
93
|
|
106
94
|
if acc.class == String
|
107
95
|
eval(acc)
|
data/lib/vimamsa/buffer.rb
CHANGED
@@ -15,7 +15,7 @@ class Buffer < String
|
|
15
15
|
|
16
16
|
attr_reader :pos, :lpos, :cpos, :deltas, :edit_history, :fname, :call_func, :pathname, :basename, :update_highlight, :marks, :is_highlighted, :syntax_detect_failed, :id, :lang
|
17
17
|
attr_writer :call_func, :update_highlight
|
18
|
-
attr_accessor :
|
18
|
+
attr_accessor :gui_update_highlight, :update_hl_startpos, :update_hl_endpos, :hl_queue, :syntax_parser, :highlights, :gui_reset_highlight, :is_parsing_syntax, :line_ends, :bt, :line_action_handler, :module, :active_kbd_mode, :title, :subtitle
|
19
19
|
|
20
20
|
@@num_buffers = 0
|
21
21
|
|
@@ -26,7 +26,7 @@ class Buffer < String
|
|
26
26
|
@lang = nil
|
27
27
|
@id = @@num_buffers
|
28
28
|
@@num_buffers += 1
|
29
|
-
|
29
|
+
gui_create_buffer(@id)
|
30
30
|
puts "NEW BUFFER fn=#{fname} ID:#{@id}"
|
31
31
|
|
32
32
|
@module = nil
|
@@ -58,7 +58,7 @@ class Buffer < String
|
|
58
58
|
end
|
59
59
|
|
60
60
|
t1 = Time.now
|
61
|
-
|
61
|
+
gui_set_current_buffer(@id)
|
62
62
|
gui_set_window_title(@title, @subtitle)
|
63
63
|
|
64
64
|
set_content(str)
|
@@ -76,7 +76,7 @@ class Buffer < String
|
|
76
76
|
else
|
77
77
|
$kbd.set_mode_to_default
|
78
78
|
end
|
79
|
-
#
|
79
|
+
# gui_set_current_buffer(@id)
|
80
80
|
end
|
81
81
|
|
82
82
|
def detect_file_language
|
@@ -108,8 +108,7 @@ class Buffer < String
|
|
108
108
|
def add_image(imgpath, pos)
|
109
109
|
return if !is_legal_pos(pos)
|
110
110
|
# insert_txt_at(" ", pos)
|
111
|
-
|
112
|
-
qt_add_image(imgpath, pos)
|
111
|
+
gui_add_image(imgpath, pos)
|
113
112
|
end
|
114
113
|
|
115
114
|
def is_legal_pos(pos, op = :read)
|
@@ -141,7 +140,6 @@ class Buffer < String
|
|
141
140
|
b = " \n"
|
142
141
|
txt = a + b
|
143
142
|
insert_txt_at(txt, lr.end + 1)
|
144
|
-
qt_process_deltas
|
145
143
|
imgpos = lr.end + 1 + a.size
|
146
144
|
add_image(fname, imgpos)
|
147
145
|
end
|
@@ -209,7 +207,7 @@ class Buffer < String
|
|
209
207
|
|
210
208
|
def set_content(str)
|
211
209
|
@encrypted_str = nil
|
212
|
-
@
|
210
|
+
@gui_update_highlight = true
|
213
211
|
@ftype = nil
|
214
212
|
if str[0..10] == "VMACRYPT001"
|
215
213
|
@encrypted_str = str[11..-1]
|
@@ -263,7 +261,7 @@ class Buffer < String
|
|
263
261
|
@update_hl_startpos = 0 #TODO
|
264
262
|
@update_hl_endpos = self.size - 1
|
265
263
|
|
266
|
-
|
264
|
+
gui_set_buffer_contents(@id, self.to_s)
|
267
265
|
|
268
266
|
# add_hl_update(@update_hl_startpos, @update_hl_endpos)
|
269
267
|
end
|
@@ -272,6 +270,12 @@ class Buffer < String
|
|
272
270
|
@fname = filename
|
273
271
|
@pathname = Pathname.new(fname) if @fname
|
274
272
|
@basename = @pathname.basename if @fname
|
273
|
+
|
274
|
+
@title = File.basename(@fname)
|
275
|
+
@dirname = File.dirname(@fname)
|
276
|
+
userhome = File.expand_path("~")
|
277
|
+
@subtitle = @dirname.gsub(/^#{userhome}/, "~")
|
278
|
+
|
275
279
|
detect_file_language
|
276
280
|
end
|
277
281
|
|
@@ -752,7 +756,7 @@ class Buffer < String
|
|
752
756
|
elsif new_pos >= 0
|
753
757
|
@pos = new_pos
|
754
758
|
end
|
755
|
-
|
759
|
+
gui_set_cursor_pos(@id, @pos)
|
756
760
|
calculate_line_and_column_pos
|
757
761
|
end
|
758
762
|
|
@@ -1481,7 +1485,6 @@ class Buffer < String
|
|
1481
1485
|
def start_visual_mode()
|
1482
1486
|
@visual_mode = true
|
1483
1487
|
@selection_start = @pos
|
1484
|
-
qt_set_selection_start(@id, selection_start)
|
1485
1488
|
$kbd.set_mode(:visual)
|
1486
1489
|
end
|
1487
1490
|
|
@@ -1637,9 +1640,14 @@ class Buffer < String
|
|
1637
1640
|
savepath = buflist.get_last_dir
|
1638
1641
|
end
|
1639
1642
|
# Ripl.start :binding => binding
|
1640
|
-
|
1643
|
+
gui_file_saveas(savepath)
|
1641
1644
|
# calls back to file_saveas
|
1642
|
-
|
1645
|
+
end
|
1646
|
+
|
1647
|
+
def save_as_callback(fpath)
|
1648
|
+
set_filename(fpath)
|
1649
|
+
save()
|
1650
|
+
gui_set_window_title(@title, @subtitle) #TODO: if not active buffer?
|
1643
1651
|
end
|
1644
1652
|
|
1645
1653
|
def write_contents_to_file(fpath)
|
@@ -1720,14 +1728,13 @@ class Buffer < String
|
|
1720
1728
|
def backup()
|
1721
1729
|
fname = @fname
|
1722
1730
|
return if !@fname
|
1723
|
-
message("Backup buffer #{fname}")
|
1724
1731
|
spfx = fname.gsub("=", "==").gsub("/", "=:")
|
1725
|
-
spath = File.expand_path("
|
1732
|
+
spath = File.expand_path("~/.vimamsa/backup")
|
1726
1733
|
return false if !can_save_to_directory?(spath)
|
1727
1734
|
datetime = DateTime.now().strftime("%d%m%Y:%H%M%S")
|
1728
1735
|
savepath = "#{spath}/#{spfx}_#{datetime}"
|
1736
|
+
message("Backup buffer #{fname} TO: #{savepath}")
|
1729
1737
|
if is_path_writable(savepath)
|
1730
|
-
debug "BACKUP BUFFER TO: #{savepath}"
|
1731
1738
|
write_contents_to_file(savepath)
|
1732
1739
|
else
|
1733
1740
|
message("PATH NOT WRITABLE: #{savepath}")
|
data/lib/vimamsa/buffer_list.rb
CHANGED
@@ -30,8 +30,8 @@ class BufferList < Array
|
|
30
30
|
$buffer_history << @current_buf
|
31
31
|
@recent_ind = 0
|
32
32
|
$hook.call(:change_buffer, $buffer)
|
33
|
-
|
34
|
-
|
33
|
+
gui_set_current_buffer($buffer.id)
|
34
|
+
gui_set_cursor_pos($buffer.id, $buffer.pos)
|
35
35
|
end
|
36
36
|
|
37
37
|
def switch()
|
@@ -83,7 +83,7 @@ class BufferList < Array
|
|
83
83
|
$hook.call(:change_buffer, $buffer)
|
84
84
|
$buffer.set_active
|
85
85
|
|
86
|
-
|
86
|
+
gui_set_current_buffer($buffer.id)
|
87
87
|
gui_set_window_title($buffer.title,$buffer.subtitle)
|
88
88
|
|
89
89
|
# hpt_scan_images() if $debug # experimental
|
data/lib/vimamsa/debug.rb
CHANGED
@@ -95,16 +95,16 @@ def run_test(test_id)
|
|
95
95
|
$buffer = old_buffer
|
96
96
|
end
|
97
97
|
|
98
|
-
|
98
|
+
#TODO: remove?
|
99
|
+
def gui_sleep(t2)
|
99
100
|
t1 = Time.now()
|
100
101
|
while Time.now < t1 + t2
|
101
|
-
qt_process_events
|
102
102
|
sleep(0.02)
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
106
|
def run_random_jump_test__tmpl(test_time = 60 * 60 * 10)
|
107
|
-
open_new_file("TODO");
|
107
|
+
open_new_file("TODO"); gui_sleep(0.1)
|
108
108
|
|
109
109
|
ttstart = Time.now
|
110
110
|
Kernel.srand(1231)
|
@@ -114,7 +114,7 @@ def run_random_jump_test__tmpl(test_time = 60 * 60 * 10)
|
|
114
114
|
buf.jump_to_random_pos
|
115
115
|
buf.insert_txt("Z") if rand() > 0.25
|
116
116
|
buf.reset_highlight() if rand() > 0.1
|
117
|
-
|
117
|
+
gui_trigger_event
|
118
118
|
|
119
119
|
# puts "========line:========="
|
120
120
|
# puts buf.current_line()
|
@@ -122,12 +122,12 @@ def run_random_jump_test__tmpl(test_time = 60 * 60 * 10)
|
|
122
122
|
|
123
123
|
render_buffer($buffer)
|
124
124
|
|
125
|
-
|
125
|
+
gui_sleep(rand() / 2)
|
126
126
|
if rand() < (1 / 40.0)
|
127
127
|
buf.revert
|
128
128
|
end
|
129
129
|
|
130
|
-
|
130
|
+
gui_trigger_event
|
131
131
|
buf.insert_txt("X") if rand() > 0.25
|
132
132
|
render_buffer($buffer)
|
133
133
|
|
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
|