diff options
| -rw-r--r-- | lua/clever_f/feedback_service.lua | 11 | ||||
| -rw-r--r-- | tests/run.lua | 18 |
2 files changed, 29 insertions, 0 deletions
diff --git a/lua/clever_f/feedback_service.lua b/lua/clever_f/feedback_service.lua index ac5f54b..4262e1b 100644 --- a/lua/clever_f/feedback_service.lua +++ b/lua/clever_f/feedback_service.lua @@ -662,6 +662,17 @@ local function has_target_overlay(record, window) return false end +function FeedbackService:primary_restoration_active(context, window) + local record = service_records[self] + context = domain.ModeContext.from_full_mode(context) + local mark_char = record.policy:sample_markers().mark_char + if not mark_char or not M.persistent_context_eligible(context) then + return false + end + window = window or record.host:read_window() + return not has_target_overlay(record, window) +end + function FeedbackService:migrate_command(request) local reason = M.command_migration_reason(request) local record = service_records[self] diff --git a/tests/run.lua b/tests/run.lua index 0e33c03..9793411 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -6738,6 +6738,24 @@ test("Timer cleanup preserves primary movement history", function() same(domain.ModeContext.from_full_mode("n"), state.last_input_context) end) +test("Primary restoration samples marker and context eligibility", function() + local _, transitions = fresh_sequence_state() + local host = MemoryHost.new({ + configuration = { mark_char = false }, + }) + local feedback = feedback_service.new({ + host = host, + transitions = transitions, + }) + + falsy(feedback:primary_restoration_active("n", "window-1")) + host:set_configuration("mark_char", true) + falsy(feedback:primary_restoration_active("no", "window-1")) + truthy(feedback:primary_restoration_active("n", "window-1")) + truthy(feedback:primary_restoration_active("v", "window-1")) + truthy(feedback:primary_restoration_active("s", "window-1")) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
