summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua/clever_f/sequence_coordinator.lua8
-rw-r--r--tests/run.lua22
2 files changed, 27 insertions, 3 deletions
diff --git a/lua/clever_f/sequence_coordinator.lua b/lua/clever_f/sequence_coordinator.lua
index f5e8a95..0be5494 100644
--- a/lua/clever_f/sequence_coordinator.lua
+++ b/lua/clever_f/sequence_coordinator.lua
@@ -280,10 +280,12 @@ function SequenceCoordinator:stored_primary_resolution(
if type(resolver.resolve_primary_direction) ~= "function" then
fail("SequenceCoordinator repeat resolver must resolve primary direction", 2)
end
- local effective_descriptor = resolver:resolve_primary_direction(
- stored_descriptor,
- pressed_descriptor
+ local effective_descriptor = domain.Descriptor.from_string(
+ resolver:resolve_primary_direction(stored_descriptor, pressed_descriptor)
)
+ if effective_descriptor.family ~= stored_descriptor.family then
+ fail("primary repetition must preserve the stored motion family", 2)
+ end
return {
kind = "repeat",
invocation = invocation,
diff --git a/tests/run.lua b/tests/run.lua
index d9fcf26..3537f0a 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -7420,6 +7420,28 @@ test("Timely primary repetition resolves live effective direction", function()
same(domain.Descriptor.FIND_FORWARD, fixed.effective_descriptor)
end)
+test("Primary repetition preserves the stored motion family", function()
+ for _, stored in ipairs({ "f", "F", "t", "T" }) do
+ for _, pressed in ipairs({ "f", "F", "t", "T" }) do
+ local _, transitions = fresh_sequence_state()
+ local landing = domain.Position.new(1, 3)
+ transitions:BeginAcquisition("n", stored)
+ transitions:CommitAcquiredTarget("n", target("a"))
+ transitions:CommitCommandSuccess("n", landing, true)
+ local host = MemoryHost.new({
+ buffer_lines = { "ababa" },
+ cursor = landing,
+ })
+ local resolution = sequence_coordinator.new({ host = host }):primary(pressed)
+ same(
+ domain.Descriptor.from_string(stored).family,
+ resolution.effective_descriptor.family,
+ stored .. "/" .. pressed
+ )
+ end
+ end
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then