summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua/99/init.lua9
-rw-r--r--lua/99/ops/throbber.lua6
-rw-r--r--lua/99/test/throbber.lua6
-rw-r--r--lua/99/window/init.lua5
-rw-r--r--scratch/refresh.lua2
5 files changed, 18 insertions, 10 deletions
diff --git a/lua/99/init.lua b/lua/99/init.lua
index dcb1aa3..eb580c6 100644
--- a/lua/99/init.lua
+++ b/lua/99/init.lua
@@ -255,10 +255,11 @@ local function set_selection_marks()
end
--- @param cb fun(context: _99.RequestContext, o: _99.ops.Opts?): nil
+--- @param name string
--- @param context _99.RequestContext
--- @param opts _99.ops.Opts
-local function capture_prompt(cb, context, opts)
- Window.capture_input({
+local function capture_prompt(cb, name, context, opts)
+ Window.capture_input(name, {
--- @param ok boolean
--- @param response string
cb = function(ok, response)
@@ -330,7 +331,7 @@ function _99.search(opts)
ops.search(context, o)
return
else
- capture_prompt(ops.search, context, o)
+ capture_prompt(ops.search, "Search", context, o)
end
end
@@ -364,7 +365,7 @@ function _99.visual(opts)
if opts.additional_prompt then
perform_range()
else
- capture_prompt(perform_range, context, opts)
+ capture_prompt(perform_range, "Visual", context, opts)
end
end
diff --git a/lua/99/ops/throbber.lua b/lua/99/ops/throbber.lua
index 6229e45..b994fcd 100644
--- a/lua/99/ops/throbber.lua
+++ b/lua/99/ops/throbber.lua
@@ -1,5 +1,5 @@
local time = require("99.time")
-local throb_text = {
+local throb_icons = {
{ "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" },
{ "◐", "◓", "◑", "◒" },
{ "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷" },
@@ -16,7 +16,7 @@ local function create_throbber(ease_fn)
ease_fn = ease_fn or function(p)
return p
end
- local icon_set = throb_text[math.random(#throb_text)]
+ local icon_set = throb_icons[math.random(#throb_icons)]
return function(percent)
local eased = ease_fn(percent)
local index = math.floor(eased * #icon_set) + 1
@@ -89,6 +89,6 @@ function Throbber:stop()
self.state = "stopped"
end
-Throbber._icons = throb_text
+Throbber._icons = throb_icons
return Throbber
diff --git a/lua/99/test/throbber.lua b/lua/99/test/throbber.lua
new file mode 100644
index 0000000..26e897b
--- /dev/null
+++ b/lua/99/test/throbber.lua
@@ -0,0 +1,6 @@
+local Throbber = require("99.ops.throbber")
+local eq = assert.are.same
+
+describe("Throbber", function()
+end)
+
diff --git a/lua/99/window/init.lua b/lua/99/window/init.lua
index 492581e..6451ede 100644
--- a/lua/99/window/init.lua
+++ b/lua/99/window/init.lua
@@ -336,13 +336,14 @@ end
--- @field on_load? fun(): nil
--- @field rules _99.Agents.Rules
+--- @param name string
--- @param opts _99.window.CaptureInputOpts
-function M.capture_input(opts)
+function M.capture_input(name, opts)
M.clear_active_popups()
local config = create_centered_window()
local win = create_floating_window(config, {
- title = " 99 Prompt ",
+ title = string.format(" 99 %s ", name),
border = "rounded",
})
set_defaul_win_options(win, "99-prompt")
diff --git a/scratch/refresh.lua b/scratch/refresh.lua
index 8f2c8b2..687a698 100644
--- a/scratch/refresh.lua
+++ b/scratch/refresh.lua
@@ -11,7 +11,7 @@ _99.setup({
},
})
-Window.capture_input({
+Window.capture_input("test", {
cb = function(_, _)
print("results")
end,