Skip to content

Commit fe8c572

Browse files
committed
fix(leap): char<enter> works with count now
1 parent 6f29127 commit fe8c572

File tree

2 files changed

+69
-47
lines changed

2 files changed

+69
-47
lines changed

fnl/leap/main.fnl

+15-8
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ is either labeled (C) or not (B).
464464
; Show beacons (labels & match highlights) ahead of time,
465465
; right after the first input?
466466
{:aot? (not (or (= max-phase-one-targets 0)
467-
count
468467
empty-label-lists?
469468
multi-select?
470469
user-given-targets?))
@@ -656,7 +655,12 @@ is either labeled (C) or not (B).
656655
in1 in1))
657656

658657
(fn get-second-pattern-input [targets]
659-
(when (<= (length targets) max-phase-one-targets)
658+
(when (and (<= (length targets) max-phase-one-targets)
659+
; Note: `count` does _not_ automatically disable
660+
; two-phase processing, as we might want to give
661+
; char<enter> partial input (but it implies not needing
662+
; to show beacons).
663+
(not count))
660664
(with-highlight-chores (light-up-beacons targets)))
661665
(get-input-by-keymap prompt))
662666

@@ -828,15 +832,18 @@ is either labeled (C) or not (B).
828832
(when-not in2
829833
(exit-early))
830834

831-
; Jump eagerly to the very first match (without giving the full pattern)?
835+
; Jump eagerly to the count-th match (without giving the full pattern)?
832836
(when (= in2 spec-keys.next_phase_one_target)
833-
(local first (. targets 1))
834-
(local in2* (. first :chars 2))
837+
(local n (or count 1))
838+
(local target (. targets n))
839+
(when-not target
840+
(exit-early))
841+
(local in2* (. target :chars 2))
835842
(update-repeat-state {: in1 :in2 in2*})
836-
(do-action first)
843+
(do-action target)
837844
(if (or (= (length targets) 1) op-mode? (not directional?) user-given-action)
838-
(set-dot-repeat in1 in2* 1)
839-
(traversal-loop targets 1 {:no-labels? true})) ; REDRAW (LOOP)
845+
(set-dot-repeat in1 in2* n)
846+
(traversal-loop targets n {:no-labels? true})) ; REDRAW (LOOP)
840847
(exit))
841848

842849
; Do this now - repeat can succeed, even if we fail this time.

lua/leap/main.lua

+54-39
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)