fix(git/status_view): scope dispatch to current tabpage + test cleanup
This commit is contained in:
+19
-2
@@ -138,10 +138,27 @@ end
|
||||
---@param content string
|
||||
function M.write(dir, path, content)
|
||||
local full = vim.fs.joinpath(dir, path)
|
||||
vim.fn.mkdir(vim.fs.dirname(full), "p")
|
||||
local f = assert(io.open(full --[[@as string]], "w"))
|
||||
local parent = vim.fs.dirname(full)
|
||||
vim.fn.mkdir(parent, "p")
|
||||
local f, err = io.open(full, "w")
|
||||
if not f then
|
||||
error(err or "io.open failed: " .. full)
|
||||
end
|
||||
f:write(content)
|
||||
f:close()
|
||||
end
|
||||
|
||||
---@param keys string
|
||||
function M.press(keys)
|
||||
local rhs = vim.api.nvim_replace_termcodes(keys, true, false, true)
|
||||
vim.api.nvim_feedkeys(rhs, "x", false)
|
||||
end
|
||||
|
||||
---@param cond fun(): boolean
|
||||
---@param msg string
|
||||
---@param timeout integer?
|
||||
function M.wait_for(cond, msg, timeout)
|
||||
M.truthy(vim.wait(timeout or 1000, cond), "timed out waiting for: " .. msg)
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user