diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 13:39:19 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 13:39:19 +0200 |
| commit | 39394e207de59e6cfd6d92d8678d8085bbf2b90a (patch) | |
| tree | 353a141e308dc55bbb67379aaf73b8f0c5d00d55 /lua/clever_f/sequence_coordinator.lua | |
| parent | 973ca221adfce140eb3ce7e537abfaef70c32e3e (diff) | |
Read stored primary sequence
Diffstat (limited to 'lua/clever_f/sequence_coordinator.lua')
| -rw-r--r-- | lua/clever_f/sequence_coordinator.lua | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/lua/clever_f/sequence_coordinator.lua b/lua/clever_f/sequence_coordinator.lua index 837acf5..350c026 100644 --- a/lua/clever_f/sequence_coordinator.lua +++ b/lua/clever_f/sequence_coordinator.lua @@ -261,6 +261,31 @@ function SequenceCoordinator:evaluate_repeat_timeout(invocation) } end +function SequenceCoordinator:stored_primary_resolution( + invocation, + pressed_descriptor, + timeout +) + if type(invocation) ~= "table" or not domain.ModeContext.is(invocation.context) then + fail("stored primary resolution requires invocation state", 2) + end + pressed_descriptor = self:validate_primary_descriptor(pressed_descriptor) + local state = coordinator_records[self].state + local stored_descriptor = state:get_previous_descriptor(invocation.context) + local stored_target = state:get_previous_target(invocation.context) + if stored_descriptor == nil or stored_target == nil then + fail("repeat-eligible primary state must contain descriptor and target", 2) + end + return { + kind = "repeat", + invocation = invocation, + pressed_descriptor = pressed_descriptor, + timeout = timeout, + stored_descriptor = stored_descriptor, + target = stored_target, + } +end + function SequenceCoordinator:primary(value) local descriptor = self:validate_primary_descriptor(value) local invocation = self:read_primary_invocation() @@ -284,12 +309,7 @@ function SequenceCoordinator:primary(value) end return self:resolve_acquisition(descriptor, invocation) end - return { - kind = "repeat", - invocation = invocation, - pressed_descriptor = descriptor, - timeout = timeout, - } + return self:stored_primary_resolution(invocation, descriptor, timeout) end function M.new(options) |
