@@ -196,22 +196,16 @@ char separately.
196196 (+ (ch1:len ) (ch2:len )))))
197197
198198
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 )
201+ pad (or target.pad " " )
202202 label (or (. opts.substitute_chars target.label ) target.label )
203- text (.. label pad )
203+ text (or target.text ( .. label pad ) )
204204 virttext (case target.label - state
205205 :selected [[text hl.group.label - selected ]]
206206 :active-primary [[text hl.group.label - primary ]]
207207 :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 ))]
215209 (set target.beacon (when virttext [offset virttext ]))))
216210
217211
@@ -344,13 +338,13 @@ is either labeled (C) or not (B).
344338 other (set- beacon - to -match- hl target )))))))))
345339
346340
347- (fn set- beacons [targets {: no - labels ? : user - given - targets ? : aot ?}]
341+ (fn set- beacons [targets {: no - labels ? : aot ?}]
348342 (if (and no - labels ? (. targets 1 :chars)) ; user-given targets might not have :chars
349343 (each [_ target (ipairs targets )]
350344 (set- beacon - to -match- hl target ))
351345 (do (each [_ target (ipairs targets )]
352346 (if target.label
353- (set- beacon -for- labeled target { : user - given - targets ? : aot ?} )
347+ (set- beacon -for- labeled target )
354348
355349 (and aot ? opts.highlight_unlabeled_phase_one_targets )
356350 (set- beacon - to -match- hl target )))
@@ -725,7 +719,7 @@ is either labeled (C) or not (B).
725719 ; setting the initial label states if using `spec-keys.repeat_search`.
726720 (when targets.label -set
727721 (set- label - states targets {: group - offset }))
728- (set- beacons targets {:aot? vars.aot ? : no - labels ? : user - given - targets ? })
722+ (set- beacons targets {:aot? vars.aot ? : no - labels ?})
729723 (local (start end ) (get - highlighted - idx - range targets no - labels ?))
730724 (with - highlight - chores (fn [] (light - up - beacons targets {: start : end }))))
731725 ; ---
@@ -790,7 +784,7 @@ is either labeled (C) or not (B).
790784 (doto (. targets i ) (tset :label nil ) (tset :beacon nil ))))))
791785 ; ---
792786 (fn display []
793- (set- beacons targets {: no - labels ? :aot? vars.aot ? : user - given - targets ? })
787+ (set- beacons targets {: no - labels ? :aot? vars.aot ?})
794788 (local (start end ) (get - highlighted - idx - range targets no - labels ?))
795789 (with - highlight - chores (fn [] (light - up - beacons targets {: start : end }))))
796790 ; ---
@@ -864,13 +858,27 @@ is either labeled (C) or not (B).
864858 (prepare - targets targets ))
865859 (do
866860 (when (> (length targets ) max - phase - one - targets )
867- (set vars.aot ? false ))
861+ (do
862+ (set vars.aot ? false )
863+ (each [_ target (ipairs targets )]
864+ (set target.beacon - offset 0 ))))
868865 (populate - sublists targets )
869866 (each [_ sublist (pairs targets.sublists )]
870867 (prepare - targets sublist ))
871- (doto targets
872- (set- initial - label - states )
873- (set- beacons {:aot? vars.aot ?}))))
868+ (set- initial - label - states targets )
869+ (each [_ target (ipairs targets )]
870+ (if vars.aot ?
871+ (do
872+ (set target.beacon - offset (get - label - offset target ))
873+ (when (and (not opts.highlight_unlabeled_phase_one_targets ) (= target.label - state :inactive))
874+ ; In this case, "no highlight" should
875+ ; unambiguously signal "no further keystrokes
876+ ; needed", so it is mandatory to show all labeled
877+ ; positions in some way.
878+ (set target.text " " )
879+ ))
880+ (when (not user - given - targets ?) (set target.pad " " ))))
881+ (set- beacons targets {:aot? vars.aot ?})))
874882 (local in2 (or ?in2 (get - second - pattern - input targets ))) ; REDRAW
875883 (when-not in2
876884 (exit - early ))
0 commit comments