@@ -196,22 +196,16 @@ char separately.
196
196
(+ (ch1:len ) (ch2:len )))))
197
197
198
198
199
- (fn set- beacon -for- labeled [target { : user - given - targets ? : aot ?} ]
200
- (let [offset (if aot ? ( get - label - offset target ) 0 ) ; user-given-targets implies (not aot)
201
- pad (if ( or user - given - targets ? aot ?) "" " " )
199
+ (fn set- beacon -for- labeled [target ]
200
+ (let [offset (or target.beacon - offset 0 ) ; user-given-targets implies (not aot)
201
+ pad (or target.pad " " )
202
202
label (or (. opts.substitute_chars target.label ) target.label )
203
- text (.. label pad )
203
+ text (or target.text ( .. label pad ) )
204
204
virttext (case target.label - state
205
205
:selected [[text hl.group.label - selected ]]
206
206
:active-primary [[text hl.group.label - primary ]]
207
207
:active-secondary [[text hl.group.label - secondary ]]
208
- :inactive (if (and aot ? (not opts.highlight_unlabeled_phase_one_targets ))
209
- ; In this case, "no highlight" should
210
- ; unambiguously signal "no further keystrokes
211
- ; needed", so it is mandatory to show all labeled
212
- ; positions in some way.
213
- [[(.. " " pad ) hl.group.label - secondary ]]
214
- :else nil ))]
208
+ :inactive (if target.text [[target.text hl.group.label - secondary ]] :else nil ))]
215
209
(set target.beacon (when virttext [offset virttext ]))))
216
210
217
211
@@ -344,13 +338,13 @@ is either labeled (C) or not (B).
344
338
other (set- beacon - to -match- hl target )))))))))
345
339
346
340
347
- (fn set- beacons [targets {: no - labels ? : user - given - targets ? : aot ?}]
341
+ (fn set- beacons [targets {: no - labels ? : aot ?}]
348
342
(if (and no - labels ? (. targets 1 :chars)) ; user-given targets might not have :chars
349
343
(each [_ target (ipairs targets )]
350
344
(set- beacon - to -match- hl target ))
351
345
(do (each [_ target (ipairs targets )]
352
346
(if target.label
353
- (set- beacon -for- labeled target { : user - given - targets ? : aot ?} )
347
+ (set- beacon -for- labeled target )
354
348
355
349
(and aot ? opts.highlight_unlabeled_phase_one_targets )
356
350
(set- beacon - to -match- hl target )))
@@ -502,6 +496,12 @@ is either labeled (C) or not (B).
502
496
:curr-idx 0 ; for traversal mode
503
497
:errmsg nil })
504
498
499
+ (macro aot - finish []
500
+ `(do
501
+ (set vars.aot ? false )
502
+ (each [_ target (ipairs targets )]
503
+ (set target.beacon - offset 0 ))))
504
+
505
505
; Macros
506
506
507
507
; Be sure not to call the macro twice accidentally,
@@ -725,7 +725,7 @@ is either labeled (C) or not (B).
725
725
; setting the initial label states if using `spec-keys.repeat_search`.
726
726
(when targets.label -set
727
727
(set- label - states targets {: group - offset }))
728
- (set- beacons targets {:aot? vars.aot ? : no - labels ? : user - given - targets ? })
728
+ (set- beacons targets {:aot? vars.aot ? : no - labels ?})
729
729
(local (start end ) (get - highlighted - idx - range targets no - labels ?))
730
730
(with - highlight - chores (fn [] (light - up - beacons targets {: start : end }))))
731
731
; ---
@@ -790,7 +790,7 @@ is either labeled (C) or not (B).
790
790
(doto (. targets i ) (tset :label nil ) (tset :beacon nil ))))))
791
791
; ---
792
792
(fn display []
793
- (set- beacons targets {: no - labels ? :aot? vars.aot ? : user - given - targets ? })
793
+ (set- beacons targets {: no - labels ? :aot? vars.aot ?})
794
794
(local (start end ) (get - highlighted - idx - range targets no - labels ?))
795
795
(with - highlight - chores (fn [] (light - up - beacons targets {: start : end }))))
796
796
; ---
@@ -864,13 +864,27 @@ is either labeled (C) or not (B).
864
864
(prepare - targets targets ))
865
865
(do
866
866
(when (> (length targets ) max - phase - one - targets )
867
- (set vars.aot ? false ))
867
+ (do
868
+ (set vars.aot ? false )
869
+ (each [_ target (ipairs targets )]
870
+ (set target.beacon - offset 0 ))))
868
871
(populate - sublists targets )
869
872
(each [_ sublist (pairs targets.sublists )]
870
873
(prepare - targets sublist ))
871
- (doto targets
872
- (set- initial - label - states )
873
- (set- beacons {:aot? vars.aot ?}))))
874
+ (set- initial - label - states targets )
875
+ (each [_ target (ipairs targets )]
876
+ (if vars.aot ?
877
+ (do
878
+ (set target.beacon - offset (get - label - offset target ))
879
+ (when (and (not opts.highlight_unlabeled_phase_one_targets ) (= target.label - state :inactive))
880
+ ; In this case, "no highlight" should
881
+ ; unambiguously signal "no further keystrokes
882
+ ; needed", so it is mandatory to show all labeled
883
+ ; positions in some way.
884
+ (set target.text " " )
885
+ ))
886
+ (when (not user - given - targets ?) (set target.pad " " ))))
887
+ (set- beacons {:aot? vars.aot ?} targets )))
874
888
(local in2 (or ?in2 (get - second - pattern - input targets ))) ; REDRAW
875
889
(when-not in2
876
890
(exit - early ))
0 commit comments