Skip to content

Commit df578c6

Browse files
committed
refactor(leap): handle partial pattern in one place
1 parent 2ff8c88 commit df578c6

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

fnl/leap/main.fnl

+5-4
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,10 @@ char separately.
674674

675675
(when _state.phase (set _state.phase 2))
676676

677-
; Jump eagerly to the count-th match (without giving the full pattern)?
678-
(local partial-pattern? (contains? spec-keys.next_target ?in2))
677+
; Jump eagerly to the first/count-th match on the whole target list?
678+
(local partial-pattern? (or _state.repeating-partial-pattern?
679+
(contains? spec-keys.next_target ?in2)))
680+
679681
; Do this now - repeat can succeed, even if we fail this time.
680682
(update-repeat-state in1 (when-not partial-pattern? ?in2))
681683

@@ -715,8 +717,7 @@ char separately.
715717
(exit-early)
716718
(exit-with-action-on count))
717719

718-
(and (or invoked-repeat? _state.repeating-partial-pattern?)
719-
(not (can-traverse? targets*)))
720+
(and invoked-repeat? (not (can-traverse? targets*)))
720721
(exit-with-action-on 1))
721722

722723
(when targets*.autojump?

lua/leap/main.lua

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

0 commit comments

Comments
 (0)