refactor: update for Yazi v25.2.26
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
--- @since 25.2.7
|
||||
--- @since 25.2.26
|
||||
|
||||
local selected_or_hovered = ya.sync(function()
|
||||
local tab, paths = cx.active, {}
|
||||
@@ -13,7 +13,7 @@ end)
|
||||
|
||||
return {
|
||||
entry = function()
|
||||
ya.manager_emit("escape", { visual = true })
|
||||
ya.mgr_emit("escape", { visual = true })
|
||||
|
||||
local urls = selected_or_hovered()
|
||||
if #urls == 0 then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.2.7
|
||||
--- @since 25.2.26
|
||||
|
||||
local function setup(_, opts)
|
||||
local type = opts and opts.type or ui.Border.ROUNDED
|
||||
@@ -24,7 +24,7 @@ local function setup(_, opts)
|
||||
c[3]:pad(ui.Pad.y(1)),
|
||||
}
|
||||
|
||||
local style = THEME.manager.border_style
|
||||
local style = th.mgr.border_style
|
||||
self._base = ya.list_merge(self._base or {}, {
|
||||
ui.Border(ui.Border.ALL):area(self._area):type(type):style(style),
|
||||
ui.Bar(ui.Bar.RIGHT):area(self._chunks[1]):style(style),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.2.7
|
||||
--- @since 25.2.26
|
||||
--- @sync entry
|
||||
|
||||
local function entry(st)
|
||||
@@ -14,12 +14,12 @@ local function entry(st)
|
||||
else
|
||||
st.old = Tab.layout
|
||||
Tab.layout = function(self)
|
||||
local all = MANAGER.ratio.parent + MANAGER.ratio.current
|
||||
local r = rt.mgr.ratio
|
||||
self._chunks = ui.Layout()
|
||||
:direction(ui.Layout.HORIZONTAL)
|
||||
:constraints({
|
||||
ui.Constraint.Ratio(MANAGER.ratio.parent, all),
|
||||
ui.Constraint.Ratio(MANAGER.ratio.current, all),
|
||||
ui.Constraint.Ratio(r.parent, r.parent + r.current),
|
||||
ui.Constraint.Ratio(r.current, r.parent + r.current),
|
||||
ui.Constraint.Length(1),
|
||||
})
|
||||
:split(self._area)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.2.7
|
||||
--- @since 25.2.26
|
||||
|
||||
local AVAILABLE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789."
|
||||
|
||||
@@ -24,9 +24,9 @@ return {
|
||||
|
||||
local kw = escape(cands[idx].on)
|
||||
if changed(kw) then
|
||||
ya.manager_emit("find_do", { "^" .. kw })
|
||||
ya.mgr_emit("find_do", { "^" .. kw })
|
||||
else
|
||||
ya.manager_emit("find_arrow", {})
|
||||
ya.mgr_emit("find_arrow", {})
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.2.7
|
||||
--- @since 25.2.26
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -32,7 +32,7 @@ function M:peek(job)
|
||||
|
||||
child:start_kill()
|
||||
if job.skip > 0 and i < job.skip + limit then
|
||||
ya.manager_emit("peek", { math.max(0, i - limit), only_if = job.file.url, upper_bound = true })
|
||||
ya.mgr_emit("peek", { math.max(0, i - limit), only_if = job.file.url, upper_bound = true })
|
||||
else
|
||||
ya.preview_widgets(job, { ui.Text(lines):area(job.area) })
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.2.7
|
||||
--- @since 25.2.26
|
||||
|
||||
local update = ya.sync(function(st, tags)
|
||||
for path, tag in pairs(tags) do
|
||||
@@ -76,7 +76,7 @@ end)
|
||||
|
||||
local function entry(self, job)
|
||||
assert(job.args[1] == "add" or job.args[1] == "remove", "Invalid action")
|
||||
ya.manager_emit("escape", { visual = true })
|
||||
ya.mgr_emit("escape", { visual = true })
|
||||
|
||||
local cands = cands()
|
||||
local choice = ya.which { cands = cands }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.2.7
|
||||
--- @since 25.2.26
|
||||
|
||||
local FILES = {
|
||||
[".envrc"] = "text/plain",
|
||||
@@ -1096,7 +1096,7 @@ function M:fetch(job)
|
||||
end
|
||||
|
||||
if next(updates) then
|
||||
ya.manager_emit("update_mimes", { updates = updates })
|
||||
ya.mgr_emit("update_mimes", { updates = updates })
|
||||
end
|
||||
|
||||
if #unknown > 0 then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.2.7
|
||||
--- @since 25.2.26
|
||||
|
||||
local toggle_ui = ya.sync(function(self)
|
||||
if self.children then
|
||||
@@ -12,7 +12,7 @@ end)
|
||||
|
||||
local subscribe = ya.sync(function(self)
|
||||
ps.unsub("mount")
|
||||
ps.sub("mount", function() ya.manager_emit("plugin", { self._id, "refresh" }) end)
|
||||
ps.sub("mount", function() ya.mgr_emit("plugin", { self._id, "refresh" }) end)
|
||||
end)
|
||||
|
||||
local update_partitions = ya.sync(function(self, partitions)
|
||||
@@ -113,7 +113,7 @@ function M:entry(job)
|
||||
elseif run == "enter" then
|
||||
local active = active_partition()
|
||||
if active and active.dist then
|
||||
ya.manager_emit("cd", { active.dist })
|
||||
ya.mgr_emit("cd", { active.dist })
|
||||
end
|
||||
else
|
||||
tx2:send(run)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- @since 25.2.7
|
||||
--- @since 25.2.26
|
||||
--- @sync entry
|
||||
|
||||
local function setup(self, opts) self.open_multi = opts.open_multi end
|
||||
|
||||
local function entry(self)
|
||||
local h = cx.active.current.hovered
|
||||
ya.manager_emit(h and h.cha.is_dir and "enter" or "open", { hovered = not self.open_multi })
|
||||
ya.mgr_emit(h and h.cha.is_dir and "enter" or "open", { hovered = not self.open_multi })
|
||||
end
|
||||
|
||||
return { entry = entry, setup = setup }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.2.7
|
||||
--- @since 25.2.26
|
||||
|
||||
local hovered = ya.sync(function()
|
||||
local h = cx.active.current.hovered
|
||||
@@ -28,20 +28,20 @@ local function entry()
|
||||
while true do
|
||||
local value, event = input:recv()
|
||||
if event ~= 1 and event ~= 3 then
|
||||
ya.manager_emit("escape", { filter = true })
|
||||
ya.mgr_emit("escape", { filter = true })
|
||||
break
|
||||
end
|
||||
|
||||
ya.manager_emit("filter_do", { value, smart = true })
|
||||
ya.mgr_emit("filter_do", { value, smart = true })
|
||||
|
||||
local h = hovered()
|
||||
if h.unique and h.is_dir then
|
||||
ya.manager_emit("escape", { filter = true })
|
||||
ya.manager_emit("enter", {})
|
||||
ya.mgr_emit("escape", { filter = true })
|
||||
ya.mgr_emit("enter", {})
|
||||
input = prompt()
|
||||
elseif event == 1 then
|
||||
ya.manager_emit("escape", { filter = true })
|
||||
ya.manager_emit(h.is_dir and "enter" or "open", { h.url })
|
||||
ya.mgr_emit("escape", { filter = true })
|
||||
ya.mgr_emit(h.is_dir and "enter" or "open", { h.url })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- @since 25.2.7
|
||||
--- @since 25.2.26
|
||||
--- @sync entry
|
||||
|
||||
local function entry(st, job)
|
||||
local R = MANAGER.ratio
|
||||
local R = rt.mgr.ratio
|
||||
job = type(job) == "string" and { args = { job } } or job
|
||||
|
||||
st.parent = st.parent and st.parent or R.parent
|
||||
|
||||
Reference in New Issue
Block a user