vimamsa 0.1.7 → 0.1.8
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/lib/vimamsa/actions.rb +6 -6
- data/lib/vimamsa/buffer.rb +69 -39
- data/lib/vimamsa/buffer_list.rb +24 -0
- data/lib/vimamsa/buffer_manager.rb +83 -0
- data/lib/vimamsa/conf.rb +21 -0
- data/lib/vimamsa/debug.rb +3 -2
- data/lib/vimamsa/easy_jump.rb +7 -7
- data/lib/vimamsa/editor.rb +24 -17
- data/lib/vimamsa/file_finder.rb +5 -6
- data/lib/vimamsa/file_history.rb +3 -3
- data/lib/vimamsa/file_manager.rb +9 -8
- data/lib/vimamsa/gui.rb +15 -17
- data/lib/vimamsa/gui_menu.rb +11 -1
- data/lib/vimamsa/gui_select_window.rb +13 -13
- data/lib/vimamsa/gui_sourceview.rb +23 -23
- data/lib/vimamsa/hyper_plain_text.rb +8 -10
- data/lib/vimamsa/key_actions.rb +4 -0
- data/lib/vimamsa/key_binding_tree.rb +27 -27
- data/lib/vimamsa/key_bindings_vimlike.rb +1 -1
- data/lib/vimamsa/macro.rb +5 -5
- data/lib/vimamsa/rbvma.rb +11 -10
- data/lib/vimamsa/search.rb +1 -1
- data/lib/vimamsa/search_replace.rb +3 -4
- data/lib/vimamsa/version.rb +1 -1
- metadata +4 -3
- data/lib/vimamsa/gui_gtk_sourceview.rb +0 -294
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6000318b31060bff83029148c2cf47cc6ff8c5939d2fc1d54951a54e8b49a538
|
4
|
+
data.tar.gz: 500cd81fe9bd605276a0802f182980c5a93d77ab5d2221548586673e85a85832
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b687b1b72df46bd9bc35622b239e9525e2dc15884f1066557e82c474e99c280577a32a3a7f60a776f5b6be0866dc86c79e2b364780413821a491160ad73875f
|
7
|
+
data.tar.gz: d5e8da0e6263f74f27ee84781efdea5126411a68ace27d244da6c5b9203924196d10bbe91541319af91539089c6391dfadfde3f76cbac6f475b2002c1fbaa16c
|
data/lib/vimamsa/actions.rb
CHANGED
@@ -28,7 +28,7 @@ def reg_act(id, callfunc, name = "", opt = {})
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def missing_callfunc
|
31
|
-
|
31
|
+
debug "missing_callfunc"
|
32
32
|
end
|
33
33
|
|
34
34
|
#TODO: remove
|
@@ -74,10 +74,10 @@ def search_actions_update_callback(search_str = "")
|
|
74
74
|
item_list = item_list2
|
75
75
|
|
76
76
|
a = filter_items(item_list, 0, search_str)
|
77
|
-
|
77
|
+
debug a.inspect
|
78
78
|
|
79
79
|
r = a.collect { |x| [x[0][0], 0, x] }
|
80
|
-
|
80
|
+
debug r.inspect
|
81
81
|
$item_list = r
|
82
82
|
|
83
83
|
r = a.collect { |x| ["[#{x[0][:key]}] #{x[0][:str]}", 0, x] }
|
@@ -88,13 +88,13 @@ def search_actions_select_callback(search_str, idx)
|
|
88
88
|
item = $item_list[idx][2]
|
89
89
|
acc = item[0][:action]
|
90
90
|
|
91
|
-
|
91
|
+
debug "Selected:" + acc.to_s
|
92
92
|
gui_select_window_close(0)
|
93
93
|
|
94
94
|
if acc.class == String
|
95
95
|
eval(acc)
|
96
96
|
elsif acc.class == Symbol
|
97
|
-
|
97
|
+
debug "Symbol"
|
98
98
|
call(acc)
|
99
99
|
end
|
100
100
|
end
|
@@ -106,7 +106,7 @@ def filter_items(item_list, item_key, search_str)
|
|
106
106
|
[item, srn_dst(search_str, item[:str])]
|
107
107
|
end
|
108
108
|
scores.sort_by! { |x| -x[1] }
|
109
|
-
|
109
|
+
debug scores.inspect
|
110
110
|
scores = scores[0..30]
|
111
111
|
|
112
112
|
return scores
|
data/lib/vimamsa/buffer.rb
CHANGED
@@ -28,7 +28,7 @@ class Buffer < String
|
|
28
28
|
@id = @@num_buffers
|
29
29
|
@@num_buffers += 1
|
30
30
|
gui_create_buffer(@id)
|
31
|
-
|
31
|
+
debug "NEW BUFFER fn=#{fname} ID:#{@id}"
|
32
32
|
|
33
33
|
@module = nil
|
34
34
|
|
@@ -71,6 +71,15 @@ class Buffer < String
|
|
71
71
|
@active_kbd_mode = nil
|
72
72
|
end
|
73
73
|
|
74
|
+
def list_str()
|
75
|
+
if @fname.nil?
|
76
|
+
x = @title
|
77
|
+
else
|
78
|
+
x = @fname
|
79
|
+
end
|
80
|
+
return x
|
81
|
+
end
|
82
|
+
|
74
83
|
def set_active
|
75
84
|
if !@active_kbd_mode.nil?
|
76
85
|
$kbd.set_mode(@active_kbd_mode)
|
@@ -104,7 +113,7 @@ class Buffer < String
|
|
104
113
|
# lang.get_metadata("block-comment-end")
|
105
114
|
@lang_nfo = lang
|
106
115
|
if !lang.nil? and !lang.id.nil?
|
107
|
-
|
116
|
+
debug "Guessed LANG: #{lang.id}"
|
108
117
|
@lang = lang.id
|
109
118
|
end
|
110
119
|
|
@@ -113,10 +122,32 @@ class Buffer < String
|
|
113
122
|
end
|
114
123
|
end
|
115
124
|
|
125
|
+
def view()
|
126
|
+
# Get the VSourceView < GtkSource::View object corresponding to this buffer
|
127
|
+
return vma.gui.buffers[@id]
|
128
|
+
end
|
129
|
+
|
116
130
|
def add_image(imgpath, pos)
|
117
131
|
return if !is_legal_pos(pos)
|
118
|
-
|
119
|
-
|
132
|
+
|
133
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:file => imgpath)
|
134
|
+
|
135
|
+
# puts GdkPixbuf::InterpType.constants
|
136
|
+
# GdkPixbuf::InterpType::HYPER
|
137
|
+
# https://docs.gtk.org/gdk-pixbuf/enum.InterpType.html#bilinear
|
138
|
+
# https://docs.gtk.org/gdk-pixbuf/method.Pixbuf.scale_simple.html
|
139
|
+
imglimit = view.visible_rect.width - 5
|
140
|
+
if pixbuf.width > imglimit
|
141
|
+
nwidth = imglimit
|
142
|
+
nheight = (pixbuf.height * (imglimit.to_f / pixbuf.width)).to_i
|
143
|
+
pixbuf = pixbuf.scale_simple(nwidth, nheight, GdkPixbuf::InterpType::HYPER)
|
144
|
+
end
|
145
|
+
|
146
|
+
vbuf = view.buffer
|
147
|
+
itr = vbuf.get_iter_at(:offset => pos)
|
148
|
+
itr2 = vbuf.get_iter_at(:offset => pos + 1)
|
149
|
+
vbuf.delete(itr, itr2)
|
150
|
+
vbuf.insert(itr, pixbuf)
|
120
151
|
end
|
121
152
|
|
122
153
|
def is_legal_pos(pos, op = :read)
|
@@ -197,20 +228,20 @@ class Buffer < String
|
|
197
228
|
ok = true
|
198
229
|
@bt.each_line { |r|
|
199
230
|
if lines[i] != r #or true
|
200
|
-
|
201
|
-
|
202
|
-
#
|
203
|
-
#
|
204
|
-
|
205
|
-
|
206
|
-
|
231
|
+
debug "NO MATCH FOR LINE:"
|
232
|
+
debug "i=#{i}["
|
233
|
+
# debug "[orig]pos=#{leaf.pos} |#{leaf.data}|"
|
234
|
+
# debug "spos=#{spos} nchar=#{leaf.nchar} epos=#{epos} a[]=\nr=|#{r}|"
|
235
|
+
debug "fromtree:|#{r}|"
|
236
|
+
debug "frombuf:|#{lines[i]}"
|
237
|
+
debug "]"
|
207
238
|
ok = false
|
208
239
|
end
|
209
240
|
i += 1
|
210
241
|
}
|
211
242
|
|
212
|
-
|
213
|
-
|
243
|
+
debug "BT: NO ERRORS" if ok
|
244
|
+
debug "BT: ERRORS" if !ok
|
214
245
|
end
|
215
246
|
|
216
247
|
def set_content(str)
|
@@ -429,11 +460,11 @@ class Buffer < String
|
|
429
460
|
end
|
430
461
|
|
431
462
|
def update_index(pos, changeamount)
|
432
|
-
#
|
463
|
+
# debug "pos #{pos}, changeamount #{changeamount}, @pos #{@pos}"
|
433
464
|
@edit_pos_history.collect! { |x| r = x if x <= pos; r = x + changeamount if x > pos; r }
|
434
465
|
# TODO: handle between removal case
|
435
466
|
for k in @marks.keys
|
436
|
-
#
|
467
|
+
# debug "change(?): pos=#{pos}, k=#{k}, #{@marks[k]}, #{changeamount}"
|
437
468
|
if @marks[k] > pos
|
438
469
|
@marks[k] = @marks[k] + changeamount
|
439
470
|
end
|
@@ -574,7 +605,7 @@ class Buffer < String
|
|
574
605
|
ls = nil
|
575
606
|
ls = @line_ends[a] if a != nil
|
576
607
|
# if a != nil and ls != @line_ends[a]
|
577
|
-
#
|
608
|
+
# debug "NO MATCH @line_ends[a]"
|
578
609
|
# end
|
579
610
|
|
580
611
|
if ls == nil
|
@@ -679,7 +710,7 @@ class Buffer < String
|
|
679
710
|
end
|
680
711
|
|
681
712
|
debug "Scan line_end time: #{Time.now - t1}"
|
682
|
-
#
|
713
|
+
#debug @line_ends
|
683
714
|
end
|
684
715
|
|
685
716
|
def sanity_check_line_ends()
|
@@ -696,7 +727,7 @@ class Buffer < String
|
|
696
727
|
end
|
697
728
|
|
698
729
|
def update_bufpos_on_change(positions, xpos, changeamount)
|
699
|
-
#
|
730
|
+
# debug "xpos=#{xpos} changeamount=#{changeamount}"
|
700
731
|
positions.collect { |x|
|
701
732
|
r = nil
|
702
733
|
r = x if x < xpos
|
@@ -731,7 +762,7 @@ class Buffer < String
|
|
731
762
|
i_nl = scan_indexes(changestr, /\n/)
|
732
763
|
i_nl.collect! { |x| x + pos }
|
733
764
|
end
|
734
|
-
#
|
765
|
+
# debug "change:#{changeamount}"
|
735
766
|
#TODO: this is the bottle neck in insert_txt action
|
736
767
|
@line_ends.collect! { |x|
|
737
768
|
r = nil
|
@@ -879,10 +910,10 @@ class Buffer < String
|
|
879
910
|
range = @pos..wmarks[0]
|
880
911
|
end
|
881
912
|
elsif range_id == :to_line_end
|
882
|
-
|
913
|
+
debug "TO LINE END"
|
883
914
|
range = @pos..(@line_ends[@lpos] - 1)
|
884
915
|
elsif range_id == :to_line_start
|
885
|
-
|
916
|
+
debug "TO LINE START: #{@lpos}"
|
886
917
|
|
887
918
|
if @cpos == 0
|
888
919
|
range = nil
|
@@ -918,15 +949,15 @@ class Buffer < String
|
|
918
949
|
end
|
919
950
|
|
920
951
|
def move(direction)
|
921
|
-
|
952
|
+
debug "cpos:#{@cpos} lpos:#{@lpos} @larger_cpos:#{@larger_cpos}"
|
922
953
|
if direction == :forward_page
|
923
|
-
|
954
|
+
debug "FORWARD PAGE"
|
924
955
|
visible_range = get_visible_area()
|
925
956
|
set_pos(visible_range[1])
|
926
957
|
top_where_cursor()
|
927
958
|
end
|
928
959
|
if direction == :backward_page
|
929
|
-
|
960
|
+
debug "backward PAGE"
|
930
961
|
visible_range = get_visible_area()
|
931
962
|
set_pos(visible_range[0])
|
932
963
|
bottom_where_cursor()
|
@@ -1029,7 +1060,7 @@ class Buffer < String
|
|
1029
1060
|
if wtype == :url
|
1030
1061
|
open_url(word)
|
1031
1062
|
elsif wtype == :linepointer
|
1032
|
-
|
1063
|
+
debug word.inspect
|
1033
1064
|
jump_to_file(word[0], word[1])
|
1034
1065
|
elsif wtype == :textfile
|
1035
1066
|
open_existing_file(word)
|
@@ -1096,10 +1127,10 @@ class Buffer < String
|
|
1096
1127
|
word_start = pos if word_start == nil
|
1097
1128
|
word_end = pos if word_end == nil
|
1098
1129
|
word = self[word_start..word_end]
|
1099
|
-
|
1130
|
+
debug "'WORD: #{word}'"
|
1100
1131
|
message("'#{word}'")
|
1101
1132
|
linep = get_file_line_pointer(word)
|
1102
|
-
|
1133
|
+
debug "linep'#{linep}'"
|
1103
1134
|
path = File.expand_path(word)
|
1104
1135
|
wtype = nil
|
1105
1136
|
if is_url(word)
|
@@ -1112,7 +1143,7 @@ class Buffer < String
|
|
1112
1143
|
wtype = :file
|
1113
1144
|
end
|
1114
1145
|
# elsif hpt_check_cur_word(word) #TODO: check only
|
1115
|
-
#
|
1146
|
+
# debug word
|
1116
1147
|
elsif linep != nil
|
1117
1148
|
wtype = :linepointer
|
1118
1149
|
word = linep
|
@@ -1140,14 +1171,14 @@ class Buffer < String
|
|
1140
1171
|
word_start = pos if word_start == nil
|
1141
1172
|
word_end = pos if word_end == nil
|
1142
1173
|
word = self[word_start..word_end]
|
1143
|
-
|
1174
|
+
debug "'#{word}'"
|
1144
1175
|
message("'#{word}'")
|
1145
|
-
#
|
1176
|
+
#debug wm
|
1146
1177
|
end
|
1147
1178
|
|
1148
1179
|
def jump_to_next_instance_of_word()
|
1149
1180
|
if $kbd.last_action == $kbd.cur_action and @current_word != nil
|
1150
|
-
#
|
1181
|
+
# debug "REPEATING *"
|
1151
1182
|
else
|
1152
1183
|
start_search = [@pos - 150, 0].max
|
1153
1184
|
|
@@ -1246,10 +1277,10 @@ class Buffer < String
|
|
1246
1277
|
|
1247
1278
|
if target == FIRST_NON_WHITESPACE
|
1248
1279
|
l = current_line()
|
1249
|
-
|
1280
|
+
debug l.inspect
|
1250
1281
|
@cpos = line(@lpos).size - 1
|
1251
1282
|
a = scan_indexes(l, /\S/)
|
1252
|
-
|
1283
|
+
debug a.inspect
|
1253
1284
|
if a.any?
|
1254
1285
|
@cpos = a[0]
|
1255
1286
|
else
|
@@ -1358,14 +1389,13 @@ class Buffer < String
|
|
1358
1389
|
if m
|
1359
1390
|
c = c + " " * m[1].size if m
|
1360
1391
|
end
|
1361
|
-
|
1362
1392
|
|
1363
1393
|
#if tab indent
|
1364
1394
|
m = /^(\t+)([^\t]+|$)/.match(last_line)
|
1365
1395
|
if m
|
1366
1396
|
c = c + "\t" * m[1].size if m
|
1367
1397
|
end
|
1368
|
-
|
1398
|
+
|
1369
1399
|
# debug m.inspect
|
1370
1400
|
end
|
1371
1401
|
if mode == BEFORE
|
@@ -1379,8 +1409,8 @@ class Buffer < String
|
|
1379
1409
|
|
1380
1410
|
#self.insert(insert_pos,c)
|
1381
1411
|
add_delta([insert_pos, INSERT, c.size, c], true)
|
1382
|
-
#
|
1383
|
-
#
|
1412
|
+
#debug("encoding: #{c.encoding}")
|
1413
|
+
#debug "c.size: #{c.size}"
|
1384
1414
|
#recalc_line_ends #TODO: optimize?
|
1385
1415
|
calculate_line_and_column_pos
|
1386
1416
|
#need_redraw!
|
@@ -1454,7 +1484,7 @@ class Buffer < String
|
|
1454
1484
|
text = $register[register]
|
1455
1485
|
end
|
1456
1486
|
end
|
1457
|
-
|
1487
|
+
debug "PASTE: #{text}"
|
1458
1488
|
|
1459
1489
|
return if text == ""
|
1460
1490
|
|
@@ -1511,7 +1541,7 @@ class Buffer < String
|
|
1511
1541
|
debug "COPY SELECTION"
|
1512
1542
|
s = self[get_visual_mode_range]
|
1513
1543
|
if x == :append
|
1514
|
-
|
1544
|
+
debug "APPEND"
|
1515
1545
|
s += "\n" + get_clipboard()
|
1516
1546
|
end
|
1517
1547
|
|
data/lib/vimamsa/buffer_list.rb
CHANGED
@@ -23,6 +23,7 @@ end
|
|
23
23
|
class BufferList < Array
|
24
24
|
attr_reader :current_buf
|
25
25
|
|
26
|
+
|
26
27
|
def <<(_buf)
|
27
28
|
super
|
28
29
|
$buffer = _buf
|
@@ -57,6 +58,12 @@ class BufferList < Array
|
|
57
58
|
buf_idx = self.index { |b| b.fname == fname }
|
58
59
|
return buf_idx
|
59
60
|
end
|
61
|
+
|
62
|
+
def get_buffer_by_id(id)
|
63
|
+
buf_idx = self.index { |b| b.id == id }
|
64
|
+
return buf_idx
|
65
|
+
end
|
66
|
+
|
60
67
|
|
61
68
|
def add_current_buf_to_history()
|
62
69
|
@recent_ind = 0
|
@@ -138,7 +145,24 @@ class BufferList < Array
|
|
138
145
|
$buffer_history = bh.reverse
|
139
146
|
end
|
140
147
|
|
148
|
+
|
149
|
+
# Close buffer in the background
|
150
|
+
# TODO: if open in another widget
|
151
|
+
def close_other_buffer(buffer_i)
|
152
|
+
return if self.size <= buffer_i
|
153
|
+
return if @current_buf == buffer_i
|
154
|
+
|
155
|
+
bufname = self[buffer_i].basename
|
156
|
+
message("Closed buffer #{bufname}")
|
157
|
+
|
158
|
+
self.slice!(buffer_i)
|
159
|
+
$buffer_history = $buffer_history.collect { |x| r = x; r = x - 1 if x > buffer_i; r = nil if x == buffer_i; r }.compact
|
160
|
+
|
161
|
+
end
|
162
|
+
|
163
|
+
|
141
164
|
def close_buffer(buffer_i, from_recent = false)
|
165
|
+
return if buffer_i.nil?
|
142
166
|
return if self.size <= buffer_i
|
143
167
|
|
144
168
|
bufname = self[buffer_i].basename
|
@@ -0,0 +1,83 @@
|
|
1
|
+
class BufferManager
|
2
|
+
attr_reader :buf
|
3
|
+
@@cur = nil # Current object of class
|
4
|
+
|
5
|
+
def self.cur()
|
6
|
+
return @@cur
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.init()
|
10
|
+
vma.kbd.add_minor_mode("bmgr", :buf_mgr, :command)
|
11
|
+
reg_act(:bmgr_select, proc { buf.module.select_line }, "")
|
12
|
+
reg_act(:bmgr_close, proc { buf.module.close_selected }, "")
|
13
|
+
|
14
|
+
reg_act(:start_buf_manager, proc { BufferManager.new.run; vma.kbd.set_mode(:buf_mgr) }, "Buffer manager")
|
15
|
+
|
16
|
+
bindkey "bmgr enter", :bmgr_select
|
17
|
+
bindkey "bmgr c", :bmgr_close
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize()
|
21
|
+
@buf = nil
|
22
|
+
@line_to_id = {}
|
23
|
+
end
|
24
|
+
|
25
|
+
def buf_of_current_line()
|
26
|
+
l = @buf.lpos - @header.size
|
27
|
+
return nil if l < 0
|
28
|
+
bufid = @line_to_id[l]
|
29
|
+
buf_i = vma.buffers.get_buffer_by_id(bufid)
|
30
|
+
return buf_i
|
31
|
+
end
|
32
|
+
|
33
|
+
def close_selected
|
34
|
+
buf_i = buf_of_current_line()
|
35
|
+
if buf_i.nil?
|
36
|
+
message("buf already closed")
|
37
|
+
return
|
38
|
+
end
|
39
|
+
vma.buffers.close_other_buffer(buf_i)
|
40
|
+
end
|
41
|
+
|
42
|
+
def select_line
|
43
|
+
buf_i = buf_of_current_line()
|
44
|
+
return if buf_i.nil?
|
45
|
+
|
46
|
+
vma.buffers.close_current_buffer()
|
47
|
+
vma.buffers.set_current_buffer(buf_i)
|
48
|
+
@@cur = nil
|
49
|
+
end
|
50
|
+
|
51
|
+
def run
|
52
|
+
if !@@cur.nil? #One instance open already
|
53
|
+
#Close it
|
54
|
+
buf_i = vma.buffers.get_buffer_by_id(@@cur.buf.id)
|
55
|
+
vma.buffers.close_buffer(buf_i)
|
56
|
+
end
|
57
|
+
@@cur = self
|
58
|
+
@header = []
|
59
|
+
@header << "Current buffers:"
|
60
|
+
@header << "keys: <enter> to select, <c> to close buffer"
|
61
|
+
@header << "=" * 40
|
62
|
+
|
63
|
+
s = ""
|
64
|
+
s << @header.join("\n")
|
65
|
+
s << "\n"
|
66
|
+
i = 0
|
67
|
+
for b in vma.buffers.sort_by { |x| x.list_str }
|
68
|
+
x = b.list_str
|
69
|
+
s << "#{x}\n"
|
70
|
+
@line_to_id[i] = b.id
|
71
|
+
i += 1
|
72
|
+
end
|
73
|
+
|
74
|
+
if @buf.nil?
|
75
|
+
@buf = create_new_file(nil, s)
|
76
|
+
@buf.module = self
|
77
|
+
@buf.active_kbd_mode = :buf_mgr
|
78
|
+
else
|
79
|
+
@buf.set_content(s)
|
80
|
+
end
|
81
|
+
@buf.set_line_and_column_pos(@header.size, 0)
|
82
|
+
end
|
83
|
+
end
|
data/lib/vimamsa/conf.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
$cnf = {} # TODO
|
2
|
+
|
3
|
+
def conf(id)
|
4
|
+
return $cnf[id]
|
5
|
+
end
|
6
|
+
|
7
|
+
def set_conf(id, val)
|
8
|
+
$cnf[id] = val
|
9
|
+
end
|
10
|
+
|
11
|
+
def setcnf(id, val)
|
12
|
+
set_conf(id, val)
|
13
|
+
end
|
14
|
+
|
15
|
+
setcnf :indent_based_on_last_line, true
|
16
|
+
setcnf :extensions_to_open, [".txt", ".h", ".c", ".cpp", ".hpp", ".rb", ".inc", ".php", ".sh", ".m", ".gd", ".js"]
|
17
|
+
|
18
|
+
|
19
|
+
setcnf "log.verbose", 1
|
20
|
+
setcnf :tab_width, 4
|
21
|
+
|
data/lib/vimamsa/debug.rb
CHANGED
data/lib/vimamsa/easy_jump.rb
CHANGED
@@ -41,12 +41,12 @@ class EasyJump
|
|
41
41
|
def easy_jump_input_char(c, event_type)
|
42
42
|
return true if event_type != :key_press
|
43
43
|
# vma.paint_stack = []
|
44
|
-
|
44
|
+
debug "EASY JUMP: easy_jump_input_char [#{c}]"
|
45
45
|
@easy_jump_input << c.upcase
|
46
46
|
if @jump_sequence.include?(@easy_jump_input)
|
47
47
|
jshash = Hash[@jump_sequence.map.with_index.to_a]
|
48
48
|
nthword = jshash[@easy_jump_input]
|
49
|
-
|
49
|
+
debug "nthword:#{nthword} #{[@easy_jump_wsmarks[nthword], @jump_sequence[nthword]]}"
|
50
50
|
buf.set_pos(@easy_jump_wsmarks[nthword])
|
51
51
|
# @kbd.set_mode(:command)
|
52
52
|
vma.kbd.remove_keyhandling_override
|
@@ -63,8 +63,8 @@ class EasyJump
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def easy_jump_draw()
|
66
|
-
#
|
67
|
-
#
|
66
|
+
# debug @jump_sequence.inspect
|
67
|
+
# debug @easy_jump_wsmarks.inspect
|
68
68
|
vma.gui.start_overlay_draw
|
69
69
|
for i in 0..(@easy_jump_wsmarks.size - 1)
|
70
70
|
vma.gui.overlay_draw_text(@jump_sequence[i], @easy_jump_wsmarks[i])
|
@@ -73,12 +73,12 @@ class EasyJump
|
|
73
73
|
|
74
74
|
return
|
75
75
|
return if @jump_sequence.empty?
|
76
|
-
|
76
|
+
debug "EASY JUMP DRAW"
|
77
77
|
screen_cord = cpp_function_wrapper(0, [@easy_jump_wsmarks])
|
78
78
|
screen_cord = screen_cord[1..@jump_sequence.size]
|
79
79
|
screen_cord.each_with_index { |point, i|
|
80
80
|
mark_str = @jump_sequence[i]
|
81
|
-
#
|
81
|
+
#debug "draw #{point[0]}x#{point[1]}"
|
82
82
|
draw_text(mark_str, point[0] + 3, point[1])
|
83
83
|
#break if m > @cpos
|
84
84
|
}
|
@@ -159,7 +159,7 @@ class EasyJump
|
|
159
159
|
}
|
160
160
|
|
161
161
|
#printf("Size of sequence: %d\n",sequence.size)
|
162
|
-
#
|
162
|
+
#debug sequence.inspect
|
163
163
|
return sequence
|
164
164
|
end
|
165
165
|
end
|