diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:00:02 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:00:02 +0200 |
| commit | 3456c6737eddf04a0dde6b21630f6a0d4c38a37f (patch) | |
| tree | 33e1a9fd9a562abd5d2dc30af985d059a2715812 | |
| parent | 916592836fd92dbb7d6c498c26ffd83fa290384e (diff) | |
Emit enabled acquisition prompt
| -rw-r--r-- | lua/clever_f/acquisition_service.lua | 4 | ||||
| -rw-r--r-- | tests/run.lua | 36 |
2 files changed, 40 insertions, 0 deletions
diff --git a/lua/clever_f/acquisition_service.lua b/lua/clever_f/acquisition_service.lua index 0b6a618..b1bb983 100644 --- a/lua/clever_f/acquisition_service.lua +++ b/lua/clever_f/acquisition_service.lua @@ -17,6 +17,7 @@ M.TemporaryResourceScope = TemporaryResourceScope M.RepeatedDirection = { SAME = "same", } +M.PROMPT = "clever-f: " local request_records = setmetatable({}, { __mode = "k" }) local service_records = setmetatable({}, { __mode = "k" }) @@ -335,6 +336,9 @@ function AcquisitionService:acquire(descriptor, context, position, count, macro_ )) record.host:redraw("screen") end + if acquisition.show_prompt and not request.macro_state.executing then + record.host:show_prompt(M.PROMPT) + end return request end diff --git a/tests/run.lua b/tests/run.lua index 8bc6ba0..5584c50 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -5029,6 +5029,42 @@ test("Interactive acquisition creates enabled direct previews", function() same(nil, macro_service:last_temporary_scope().direct_marker) end) +test("Acquisition emits the exact enabled prompt", function() + fresh_sequence_state() + local host = MemoryHost.new({ + configuration = { + mark_cursor = false, + mark_direct = false, + show_prompt = true, + }, + }) + acquisition_service.new(host):acquire( + "f", + "n", + domain.Position.new(1, 1), + nil, + nil + ) + same("clever-f: ", acquisition_service.PROMPT) + list_same({ "clever-f: " }, host:prompts()) + + fresh_sequence_state() + local macro_host = MemoryHost.new({ + configuration = { + mark_cursor = false, + show_prompt = true, + }, + }) + acquisition_service.new(macro_host):acquire( + "f", + "n", + domain.Position.new(1, 1), + nil, + "q" + ) + same(0, #macro_host:prompts()) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
