summaryrefslogtreecommitdiff
path: root/lua/99/init.lua
diff options
context:
space:
mode:
authortheprimeagain <the.primeagen@gmail.com>2026-02-28 14:29:28 -0700
committertheprimeagain <the.primeagen@gmail.com>2026-02-28 14:29:49 -0700
commit78f39f61606597ca778ec01e2058a3e652000d7e (patch)
tree332ccb8a69a98d664854a7bbb99b297f6460d2d9 /lua/99/init.lua
parentd485196b0a7956e9efb9f73eccfb126b95d113b3 (diff)
downloada4-78f39f61606597ca778ec01e2058a3e652000d7e.tar.xz
a4-78f39f61606597ca778ec01e2058a3e652000d7e.zip
selection works nicely now
Diffstat (limited to 'lua/99/init.lua')
-rw-r--r--lua/99/init.lua39
1 files changed, 5 insertions, 34 deletions
diff --git a/lua/99/init.lua b/lua/99/init.lua
index 035ee16..72e4cc0 100644
--- a/lua/99/init.lua
+++ b/lua/99/init.lua
@@ -6,6 +6,7 @@ local Tracking = require("99.state.tracking")
local Level = require("99.logger.level")
local ops = require("99.ops")
local Window = require("99.window")
+local select_window = require("99.window.select-window")
local StatusWindow = require("99.window.status-window")
local Prompt = require("99.prompt")
local State = require("99.state")
@@ -216,39 +217,6 @@ local _99 = {
FATAL = Level.FATAL,
}
---- @param requests _99.Prompt[]
----@param cb fun(r: _99.Prompt): nil
-local function capture_request(requests, cb)
- local str_requests = Tracking.to_selectable_list(requests)
-
- Window.capture_select_input("99 Select Request", {
- content = str_requests,
- cb = function(success, result)
- if not success or result == "" then
- return
- end
-
- local idx = tonumber(vim.fn.matchstr(result, "^\\d\\+"))
- if idx == nil then
- return
- end
- local r = requests[idx]
- if not r then
- print(
- "request not found... potentially report bug: " .. vim.inspect(idx)
- )
- return
- end
- assert(
- r:valid(),
- "request is not valid... not sure how we got here. please report bug and this word: "
- .. vim.inspect(r.operation)
- )
- cb(r)
- end,
- })
-end
-
--- @param cb fun(context: _99.Prompt, o: _99.ops.Opts?): nil
--- @param name string
--- @param context _99.Prompt
@@ -318,7 +286,10 @@ end
function _99.open()
local requests = _99_state.tracking:successful()
- capture_request(requests, function(r)
+ local str_requests = Tracking.to_selectable_list(requests)
+ select_window(str_requests, function(idx)
+ local r = requests[idx]
+ assert(r:valid(), "encountered unexpected issue. malformated data")
if r.operation == "visual" then
--- TODO: this is its own work item for being able to have a global mark
--- section in which i keep track of marks for the lifetime of the