summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua/clever_f/acquisition_service.lua4
-rw-r--r--tests/run.lua36
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