From d1ba6bdac0924a5592e25e8bf80c595c1c05ce4c Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 14:18:01 +0200 Subject: Install sampled eager hooks --- lua/clever_f/composition_root.lua | 2 ++ tests/run.lua | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/lua/clever_f/composition_root.lua b/lua/clever_f/composition_root.lua index 527fec6..ecd1047 100644 --- a/lua/clever_f/composition_root.lua +++ b/lua/clever_f/composition_root.lua @@ -83,6 +83,7 @@ end function CompositionRoot:activate() local record = root_records[self] if record.activation == nil then + local feedback_activation = record.feedback:activate() local highlights = record.feedback:evaluate_highlights() local colorscheme_registration = record.host:register_events( "ColorScheme", @@ -93,6 +94,7 @@ function CompositionRoot:activate() ) record.activation = { state = record.state, + feedback = feedback_activation, highlights = highlights, colorscheme_registration = colorscheme_registration, } diff --git a/tests/run.lua b/tests/run.lua index 555faad..17749c9 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -7127,6 +7127,35 @@ test("Core activation refreshes highlights after colorscheme changes", function( same("Search", host:highlight_groups().CleverFChar.link) end) +test("Core activation installs sampled eager window hooks", function() + fresh_sequence_state() + local enabled_host = MemoryHost.new({ + configuration = { clean_labels_eagerly = true }, + }) + local enabled_root = composition_root.new({ host = enabled_host }) + local enabled = enabled_root:activate() + truthy(enabled.feedback.eager_registration ~= nil) + list_same( + feedback_service.EAGER_EVENTS, + enabled_host:event_registrations()[ + enabled.feedback.eager_registration + ].names + ) + + enabled_host:set_configuration("clean_labels_eagerly", false) + same( + enabled.feedback.eager_registration, + enabled_root:activate().feedback.eager_registration + ) + + fresh_sequence_state() + local disabled_host = MemoryHost.new({ + configuration = { clean_labels_eagerly = false }, + }) + local disabled = composition_root.new({ host = disabled_host }):activate() + same(nil, disabled.feedback.eager_registration) +end) + test("Primary coordination accepts only the four motion descriptors", function() local coordinator = sequence_coordinator.new({ host = MemoryHost.new() }) for _, value in ipairs({ "f", "F", "t", "T" }) do -- cgit v1.2.3