From b19a8857d7ff9849ee2c1c1e2a436e6c23fd08db Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 12:34:50 +0200 Subject: Allow eligible feedback contexts --- lua/clever_f/feedback_service.lua | 8 ++++++-- tests/run.lua | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/lua/clever_f/feedback_service.lua b/lua/clever_f/feedback_service.lua index a5b0dd0..b9735ee 100644 --- a/lua/clever_f/feedback_service.lua +++ b/lua/clever_f/feedback_service.lua @@ -32,6 +32,11 @@ local FEATURE_GROUPS = { "CleverFDirect", } +local LEGACY_NORMAL_EX_CONTEXTS = { + cv = true, + cvr = true, +} + local DEFAULT_LABEL_DEFINITION = { guifg = "red", guibg = "NONE", @@ -306,8 +311,7 @@ function M.persistent_context_eligible(context) return context.key == "n" or context.visual_kind ~= nil or context.select_kind ~= nil - or context.key == "cv" - or context.key == "cvr" + or LEGACY_NORMAL_EX_CONTEXTS[context.key] == true end function M.persistent_destination( diff --git a/tests/run.lua b/tests/run.lua index 7cb848c..b337b10 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -5983,6 +5983,32 @@ test("Persistent matches share one high-priority character overlay", function() same(1, map_size(host:highlights())) end) +test("Persistent feedback accepts every eligible mode context", function() + local eligible = { + "n", + "v", + "V", + string.char(0x16), + "s", + "S", + string.char(0x13), + "cv", + "cvr", + } + for _, context in ipairs(eligible) do + truthy( + feedback_service.persistent_context_eligible(context), + "expected eligible context " .. string.format("%q", context) + ) + end + for _, context in ipairs({ "no", "nov", "c", "niI" }) do + falsy( + feedback_service.persistent_context_eligible(context), + "expected ineligible context " .. context + ) + end +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3