Skip to content

Commit 2ff8c88

Browse files
committed
fix(leap): always save repeat state when having a pattern
1 parent 154a775 commit 2ff8c88

File tree

2 files changed

+30
-23
lines changed

2 files changed

+30
-23
lines changed

fnl/leap/main.fnl

+5-5
Original file line numberDiff line numberDiff line change
@@ -675,12 +675,15 @@ char separately.
675675
(when _state.phase (set _state.phase 2))
676676

677677
; Jump eagerly to the count-th match (without giving the full pattern)?
678-
(when (contains? spec-keys.next_target ?in2)
678+
(local partial-pattern? (contains? spec-keys.next_target ?in2))
679+
; Do this now - repeat can succeed, even if we fail this time.
680+
(update-repeat-state in1 (when-not partial-pattern? ?in2))
681+
682+
(when partial-pattern?
679683
(local n (or count 1))
680684
(local target (. targets n))
681685
(when-not target
682686
(exit-early))
683-
(update-repeat-state in1 nil)
684687
; Do this before `do-action`, because it might erase forced motion.
685688
; (The `:normal` command in `jump.jump-to!` can change the state of
686689
; `mode()`. See vim/vim#9332.)
@@ -692,9 +695,6 @@ char separately.
692695

693696
(exec-user-autocmds :LeapPatternPost)
694697

695-
; Do this now - repeat can succeed, even if we fail this time.
696-
(update-repeat-state in1 ?in2)
697-
698698
; Get the sublist for ?in2, and work with that from here on (except if
699699
; we've been given custom targets).
700700
(local targets* (if targets.sublists (. targets.sublists ?in2) targets))

lua/leap/main.lua

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

0 commit comments

Comments
 (0)