summaryrefslogtreecommitdiff
path: root/lua/clever_f/sequence_coordinator.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/clever_f/sequence_coordinator.lua')
-rw-r--r--lua/clever_f/sequence_coordinator.lua40
1 files changed, 28 insertions, 12 deletions
diff --git a/lua/clever_f/sequence_coordinator.lua b/lua/clever_f/sequence_coordinator.lua
index ee50fbd..cb6bf80 100644
--- a/lua/clever_f/sequence_coordinator.lua
+++ b/lua/clever_f/sequence_coordinator.lua
@@ -424,6 +424,19 @@ function SequenceCoordinator:stored_primary_resolution(
return resolution
end
+function SequenceCoordinator:refresh_primary_feedback(resolution)
+ if type(resolution) ~= "table" or not domain.TargetValue.is(resolution.target) then
+ fail("primary feedback refresh requires a resolved target", 2)
+ end
+ local record = coordinator_records[self]
+ if type(record.feedback.refresh_primary) ~= "function" then
+ fail("FeedbackService must refresh primary feedback", 2)
+ end
+ local window = resolution.timeout and resolution.timeout.window
+ or record.host:read_window()
+ return record.feedback:refresh_primary(resolution.target, window)
+end
+
function SequenceCoordinator:execute_primary_resolution(resolution)
if type(resolution) ~= "table"
or not domain.ModeContext.is(resolution.invocation.context)
@@ -433,20 +446,23 @@ function SequenceCoordinator:execute_primary_resolution(resolution)
end
local record = coordinator_records[self]
record.last_primary_resolution = resolution
+ local outcome
if resolution.skip_destination then
- return domain.ActionOutcome.empty(resolution.invocation.position)
- end
- local view = resolution.text_view or text_topology.from_host(record.host)
- local outcome = record.motion_executor:execute(
- view,
- resolution.invocation.context,
- resolution.motion_plan,
- resolution.invocation.count,
- resolution.first_move
- )
- if not domain.ActionOutcome.is(outcome) then
- fail("MotionExecutor must return an ActionOutcome", 2)
+ outcome = domain.ActionOutcome.empty(resolution.invocation.position)
+ else
+ local view = resolution.text_view or text_topology.from_host(record.host)
+ outcome = record.motion_executor:execute(
+ view,
+ resolution.invocation.context,
+ resolution.motion_plan,
+ resolution.invocation.count,
+ resolution.first_move
+ )
+ if not domain.ActionOutcome.is(outcome) then
+ fail("MotionExecutor must return an ActionOutcome", 2)
+ end
end
+ resolution.highlight_timer = self:refresh_primary_feedback(resolution)
return outcome
end