@@ -151,27 +151,18 @@ function! s:LibmodalEnterWithCombos(modeName, modeCombos) abort
151
151
152
152
" Stop timers that would clear user input.
153
153
if exists (' s:' . a: modeName . ' ModeTimer' )
154
-
154
+ if timer_info (s: {a: modeName }ModeTimer) != []
155
+ echom ' Stopping timer.'
156
+ endif
155
157
call timer_stop (s: {a: modeName }ModeTimer)
156
158
unlet s: {a: modeName }ModeTimer
157
- endif
158
-
159
- " Initialize variables necessary to execute combo modes.
160
- if ! exists (' s:' . a: modeName . ' ModeCombos' )
161
- " Build a pseudo-parse-tree.
162
- let s: {a: modeName }ModeCombos = {}
163
- for l: splitCombos in s: SplitArgDict (a: modeCombos )
164
- let s: {a: modeName }ModeCombos = s: NewComboDict (
165
- \ s: {a: modeName }ModeCombos, l: splitCombos , a: modeCombos [join (l: splitCombos , ' ' )]
166
- \)
167
- endfor
168
-
169
- " Initialize the input history variable.
170
- call s: ClearLocalInput (a: modeName )
159
+ else
160
+ echom " IT DOESN'T EXIST???????? >>>>>> s:" . a: modeName . " ModeTimer"
171
161
endif
172
162
173
163
" Append latest input to history.
174
164
let s: {a: modeName }ModeInput .= g: {a: modeName }ModeInput
165
+ echom ' CURRENT INPUT IS ' . s: {a: modeName }ModeInput
175
166
176
167
" Try to grab the command for the input.
177
168
let l: command = s: Get (s: {a: modeName }ModeCombos, s: {a: modeName }ModeInput)
@@ -188,23 +179,27 @@ function! s:LibmodalEnterWithCombos(modeName, modeCombos) abort
188
179
" If timers are on.
189
180
if s: True (s: {a: modeName }ModeTimeout)
190
181
191
- let l: clearFunc = function (' s:ClearLocalInput' , [a: modeName ])
182
+ let l: ClearFunc = function (' s:ClearLocalInput' , [a: modeName ])
192
183
193
184
" There is a command for this entry.
194
185
if has_key (l: command , s: EX_KEY )
186
+ " Get the command that was embedded into the ' ' key.
187
+ let l: command = l: command [s: EX_KEY ]
195
188
196
189
" Start a timer to execute user input and then clear the input history.
197
- let s {a: modeName }ModeTimer = timer_start (
190
+ echom ' Starting s:' . a: modeName . ' ModeTimer to execute command: ' . string (l: command )
191
+ let s: {a: modeName }ModeTimer = timer_start (
198
192
\ &timeoutlen , {
199
- \ _ - > execute (l: command . ' | call ' . l: clearFunc )
193
+ \ _ - > execute ([ l: command, ' call ' . l: ClearFunc ] )
200
194
\ }
201
195
\)
202
196
203
197
else
204
198
205
199
" Start a timer to clear the user's input.
206
- let s {a: modeName }ModeTimer = timer_start (
207
- \ &timeoutlen , {_ - > l: clearFunc }
200
+ echom ' Starting s:' . a: modeName . ' ModeTimer to clear input.'
201
+ let s: {a: modeName }ModeTimer = timer_start (
202
+ \ &timeoutlen , {_ - > execute ([' echom "Timer ran out. clearning."' , ' call ' . l: ClearFunc ])}
208
203
\)
209
204
endif
210
205
endif
@@ -396,9 +391,7 @@ function! libmodal#complete(...) abort
396
391
397
392
let l: completions = []
398
393
for l: completion in s: completions
399
- echom ' TESTING >>' l: completion
400
394
if stridx (l: completion , l: word ) > -1
401
- echom ' << ACCEPTED'
402
395
let l: completions = add (l: completions , l: completion )
403
396
endif
404
397
endfor
@@ -415,30 +408,34 @@ endfunction
415
408
" * `a:3` => `supressExit`
416
409
function ! libmodal#Enter (... ) abort
417
410
" Define mode indicator
411
+ unlockvar l: indicator
418
412
let l: indicator = s: NewIndicator (a: 1 )
419
413
lockvar l: indicator
420
414
421
415
" Initialize the window state for the mode.
416
+ unlockvar l: winState
422
417
let l: winState = s: Init ()
423
418
lockvar l: winState
424
419
425
420
" Convert the modename to lowercase.
421
+ unlockvar l: lower
426
422
let l: lower = tolower (a: 1 )
427
423
lockvar l: lower
428
424
429
425
" Name of variable used for input.
426
+ unlockvar l: input
430
427
let l: input = l: lower . " ModeInput"
431
428
lockvar l: input
432
429
433
430
" If the third argument, representing exit supression, has been passed.
431
+ unlockvar l: exit
434
432
if len (a: 000 ) > 2 && s: True (a: 3 )
435
433
" Create the variable used to control the exit.
436
434
let l: exit = l: lower . " ModeExit"
437
435
let g: {l: exit } = 0
438
436
else
439
437
let l: exit = 0
440
438
endif
441
-
442
439
lockvar l: exit
443
440
444
441
if type (a: 2 ) == v: t_dict
@@ -449,9 +446,26 @@ function! libmodal#Enter(...) abort
449
446
let l: timeout = g: libmodalTimeouts
450
447
endif
451
448
449
+ unlockvar s: {l: lower }ModeTimeout
452
450
let s: {l: lower }ModeTimeout = l: timeout
453
451
lockvar s: {l: lower }ModeTimeout
454
452
453
+ echom ' l:timeout >>> ' . string (s: {l: lower }ModeTimeout)
454
+ echom ' s:' . l: lower . ' ModeTimeout >>> ' . string (s: {l: lower }ModeTimeout)
455
+
456
+ " Build a pseudo-parse-tree.
457
+ let s: {l: lower }ModeCombos = {}
458
+ for l: splitCombos in s: SplitArgDict (a: 2 )
459
+ let s: {l: lower }ModeCombos = s: NewComboDict (
460
+ \ s: {l: lower }ModeCombos, l: splitCombos , a: 2 [join (l: splitCombos , ' ' )]
461
+ \)
462
+ endfor
463
+
464
+ echom ' COMBOS >>> ' . string (s: {l: lower }ModeCombos)
465
+
466
+ " Initialize the input history variable.
467
+ call s: ClearLocalInput (l: lower )
468
+
455
469
endif
456
470
457
471
" Outer loop to keep accepting commands
@@ -473,9 +487,12 @@ function! libmodal#Enter(...) abort
473
487
break
474
488
endif
475
489
476
- if type (a: 2 ) == v: t_func | call a: 2 ()
477
- elseif type (a: 2 ) == v: t_dict | call s: LibmodalEnterWithCombos (l: lower , a: 2 )
478
- else | break
490
+ if type (a: 2 ) == v: t_func
491
+ call a: 2 ()
492
+ elseif type (a: 2 ) == v: t_dict
493
+ call s: LibmodalEnterWithCombos (l: lower , a: 2 )
494
+ else
495
+ break
479
496
endif
480
497
481
498
catch
@@ -500,20 +517,22 @@ endfunction
500
517
" * `a:2` => `modeCallback` OR `modeCommands`
501
518
function ! libmodal#Prompt (... ) abort
502
519
" Define mode indicator
520
+ unlockvar l: indicator
503
521
let l: indicator = ' * ' . a: 1 . ' > '
504
522
lockvar l: indicator
505
523
506
524
" Name of variable used for input.
525
+ unlockvar l: input
507
526
let l: input = tolower (a: 1 ) . " ModeInput"
508
527
lockvar l: input
509
528
529
+ unlockvar l: completions
510
530
if type (a: 2 ) == v: t_dict
511
531
let l: completions = keys (a: 2 )
512
- lockvar l: completions
513
532
elseif len (a: 000 ) > 2
514
533
let l: completions = a: 3
515
- lockvar l: completions
516
534
endif
535
+ lockvar l: completions
517
536
518
537
" Outer loop to keep accepting commands
519
538
while 1 | try
0 commit comments