diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 11:36:29 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 11:36:29 +0200 |
| commit | 9ff556e67af425c9bdf187f214bd9323b22f2413 (patch) | |
| tree | c1f9983162ebc0a058e513f330fcf86051175160 | |
| parent | d0144bb94e02369979b8014c26b6c5c8a4bfd22e (diff) | |
Preserve colorscheme feature groups
| -rw-r--r-- | lua/clever_f/feedback_service.lua | 10 | ||||
| -rw-r--r-- | tests/run.lua | 39 |
2 files changed, 45 insertions, 4 deletions
diff --git a/lua/clever_f/feedback_service.lua b/lua/clever_f/feedback_service.lua index d09c287..f066a08 100644 --- a/lua/clever_f/feedback_service.lua +++ b/lua/clever_f/feedback_service.lua @@ -115,6 +115,16 @@ function FeedbackService:evaluate_feature_links() source = "configured", applied = true, } + else + local existing = record.host:read_highlight_group(group) + if existing ~= nil then + results[group] = { + group = group, + definition = existing, + source = "colorscheme", + applied = false, + } + end end end return results diff --git a/tests/run.lua b/tests/run.lua index 7a245f9..e1c7e78 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -4297,13 +4297,44 @@ test("Explicit color configuration forces its feature link", function() same("Search", results.CleverFCursor.target) same("Search", host:highlight_groups().CleverFCursor.link) - local operations = host:operations() - local definition = operations[#operations] - same("define_highlight_group", definition.operation) - same("CleverFCursor", definition.name) + local definition + for _, operation in ipairs(host:operations()) do + if operation.operation == "define_highlight_group" + and operation.name == "CleverFCursor" + then + definition = operation + end + end + truthy(definition ~= nil) truthy(definition.options.force) end) +test("Feature link evaluation preserves colorscheme CleverF groups", function() + local custom = { + guifg = "magenta", + gui = { reverse = true }, + } + local host = MemoryHost.new({ + highlight_groups = { + CleverFChar = custom, + }, + }) + local feedback = feedback_service.new(host) + + local results = feedback:evaluate_feature_links() + same("colorscheme", results.CleverFChar.source) + falsy(results.CleverFChar.applied) + same("magenta", results.CleverFChar.definition.guifg) + truthy(results.CleverFChar.definition.gui.reverse) + same("magenta", host:highlight_groups().CleverFChar.guifg) + + for _, operation in ipairs(host:operations()) do + if operation.operation == "define_highlight_group" then + falsy(operation.name == "CleverFChar") + end + end +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
