10
10
" sub_pair
11
11
" sub_pairs
12
12
" ambi_pair
13
+ " pair_id
13
14
" end_with
14
15
" begin_with
15
16
" matcher
25
26
" subp
26
27
27
28
let s: tick = 0
29
+ let s: pair_id = 0
28
30
29
31
" }}} Constants
30
32
@@ -140,6 +142,7 @@ function! cycle#search(class_name, ...) "{{{
140
142
let direction = get (options , ' direction' , 1 )
141
143
let l: count = get (options , ' count' , 1 )
142
144
let matches = []
145
+ let search_ctx = {}
143
146
let cword = cycle#text#new_cword ()
144
147
let cchar = cycle#text#new_cchar ()
145
148
@@ -166,7 +169,7 @@ function! cycle#search(class_name, ...) "{{{
166
169
endif
167
170
endif
168
171
169
- let phase_matches = s: phased_search (phase, groups, direction, l: count )
172
+ let phase_matches = s: phased_search (phase, groups, direction, l: count, search_ctx )
170
173
171
174
if ! empty (phase_matches)
172
175
call extend (matches, phase_matches)
@@ -177,9 +180,8 @@ function! cycle#search(class_name, ...) "{{{
177
180
endfunction " }}}
178
181
179
182
180
- function ! s: phased_search (class_name, groups, direction, count ) " {{{
183
+ function ! s: phased_search (class_name, groups, direction, count , search_ctx ) " {{{
181
184
let matches = []
182
- let search_ctx = {}
183
185
184
186
for group in a: groups
185
187
if get (group, ' _phase_matched' , 0 )
@@ -203,7 +205,7 @@ function! s:phased_search(class_name, groups, direction, count) "{{{
203
205
break
204
206
endif
205
207
206
- let [index , ctext] = s: group_search (group, a: class_name , search_ctx)
208
+ let [index , ctext] = s: group_search (group, a: class_name , a: search_ctx )
207
209
if index >= 0
208
210
if a: count == ' *'
209
211
" Grab all group items for CycleSelect
@@ -483,8 +485,9 @@ function! cycle#parse_group(group_attrs) "{{{
483
485
endif
484
486
" Note that the "end_items" (has `begin_with`) must go first, `ambi_pair`
485
487
" relies on this order to make orphaned behave as the begin part.
486
- let end_group_attrs = [end_items, extend (deepcopy (options ), {' begin_with' : begin_items})]
487
- let begin_group_attrs = [begin_items, extend (deepcopy (options ), {' end_with' : end_items})]
488
+ let s: pair_id += 1
489
+ let end_group_attrs = [end_items, extend (deepcopy (options ), {' begin_with' : begin_items, ' pair_id' : s: pair_id })]
490
+ let begin_group_attrs = [begin_items, extend (deepcopy (options ), {' end_with' : end_items, ' pair_id' : s: pair_id })]
488
491
return [cycle#parse_group (end_group_attrs),
489
492
\ cycle#parse_group (begin_group_attrs)]
490
493
endif
0 commit comments