diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:34:50 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:34:50 +0200 |
| commit | b19a8857d7ff9849ee2c1c1e2a436e6c23fd08db (patch) | |
| tree | 3b90a26a4b605b00e747815029ff356c6f1bcb19 | |
| parent | 97dd567a7847e6efb7974a000353ecf4c44e1519 (diff) | |
Allow eligible feedback contexts
| -rw-r--r-- | lua/clever_f/feedback_service.lua | 8 | ||||
| -rw-r--r-- | 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 |
