From da836c7b19f107e2d01cbd5be30f9584ecae3cb6 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 12:44:33 +0200 Subject: Stop prior primary timer --- lua/clever_f/feedback_service.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'lua') diff --git a/lua/clever_f/feedback_service.lua b/lua/clever_f/feedback_service.lua index 98f51aa..d84fcb3 100644 --- a/lua/clever_f/feedback_service.lua +++ b/lua/clever_f/feedback_service.lua @@ -119,6 +119,7 @@ local function require_host(host) or type(host.read_window) ~= "function" or type(host.register_events) ~= "function" or type(host.remove_event_registration) ~= "function" + or type(host.start_timer) ~= "function" or type(host.stop_timer) ~= "function" or type(host.supports_timers) ~= "function" or type(host.supports_cursor_presentation) ~= "function" @@ -140,6 +141,8 @@ local function require_transitions(transitions, state) or type(transitions.AddFinalizer) ~= "function" or type(transitions.RemoveFinalizer) ~= "function" or type(transitions.FullFinalization) ~= "function" + or type(transitions.SetHighlightTimer) ~= "function" + or type(transitions.ClearHighlightTimer) ~= "function" then fail("FeedbackService transitions must manage overlay resources", 3) end @@ -702,6 +705,32 @@ function FeedbackService:highlight_timer_delay() return delay end +function FeedbackService:cancel_highlight_timer() + local record = service_records[self] + local identity = record.transitions:ClearHighlightTimer() + release_highlight_timer(record, identity) + return identity +end + +function FeedbackService:handle_highlight_timer() + return false +end + +function FeedbackService:start_highlight_timer() + local record = service_records[self] + local delay = self:highlight_timer_delay() + if delay == nil then + return nil + end + self:cancel_highlight_timer() + local identity + identity = record.host:start_timer(delay, function(callback_identity) + self:handle_highlight_timer(callback_identity or identity) + end) + record.transitions:SetHighlightTimer(identity) + return identity +end + function FeedbackService:evaluate_feature_links() local record = service_records[self] local rules = record.policy:evaluate_highlight_links() -- cgit v1.2.3