diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:44:33 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:44:33 +0200 |
| commit | da836c7b19f107e2d01cbd5be30f9584ecae3cb6 (patch) | |
| tree | 503d40cdd14167135e7bcd7c9a310fcf7ea2468c /lua | |
| parent | 4aa8704dc0de5a691ddd5a71f0e3a81659463798 (diff) | |
Stop prior primary timer
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/clever_f/feedback_service.lua | 29 |
1 files changed, 29 insertions, 0 deletions
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() |
