diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:46:52 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:46:52 +0200 |
| commit | 6c3009c5041a2e661504825f68b0a3675562a647 (patch) | |
| tree | 2445344bab99a9bebd2978c023ff293350c1b87a /lua | |
| parent | 5913866a0e2918a1cab8700d79f2f0dbf5832cd1 (diff) | |
Build stored-motion restoration plan
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/clever_f/feedback_service.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lua/clever_f/feedback_service.lua b/lua/clever_f/feedback_service.lua index 4262e1b..4d19e6d 100644 --- a/lua/clever_f/feedback_service.lua +++ b/lua/clever_f/feedback_service.lua @@ -673,6 +673,41 @@ function FeedbackService:primary_restoration_active(context, window) return not has_target_overlay(record, window) end +function FeedbackService:build_primary_restoration(specification) + if type(specification) ~= "table" then + fail("primary feedback restoration must be a table", 2) + end + local window = specification.window + or service_records[self].host:read_window() + if not self:primary_restoration_active(specification.context, window) then + return nil + end + if not domain.TargetPlan.is(specification.target_plan) then + fail("primary feedback restoration requires an action TargetPlan", 2) + end + local action_motion_plan = specification.motion_plan + local search_scope = specification.search_scope + or (domain.ResolvedMotionPlan.is(action_motion_plan) + and action_motion_plan.search_scope) + or domain.SearchScope.BUFFER + local motion_plan = domain.ResolvedMotionPlan.new({ + target_plan = specification.target_plan, + descriptor = specification.stored_descriptor, + search_scope = search_scope, + endpoint_policy = specification.endpoint_policy, + }) + return self:build_persistent({ + context = specification.context, + anchor = specification.anchor, + target_plan = specification.target_plan, + motion_plan = motion_plan, + descriptor = specification.stored_descriptor, + endpoint_policy = specification.endpoint_policy, + text_view = specification.text_view, + window = window, + }) +end + function FeedbackService:migrate_command(request) local reason = M.command_migration_reason(request) local record = service_records[self] |
