mirror of
https://github.com/Ascyii/projects.yazi.git
synced 2026-01-01 03:24:24 -05:00
fix: Corrected the reading of array index of dds in yazi v0.3
This commit is contained in:
24
init.lua
24
init.lua
@@ -617,24 +617,18 @@ end)
|
|||||||
local _load_projects = ya.sync(function(state)
|
local _load_projects = ya.sync(function(state)
|
||||||
if state.save.method == "yazi" then
|
if state.save.method == "yazi" then
|
||||||
ps.sub_remote("@projects", function(body)
|
ps.sub_remote("@projects", function(body)
|
||||||
if not state.projects and body then
|
state.projects = body
|
||||||
state.projects = _get_default_projects()
|
|
||||||
|
|
||||||
for _, value in pairs(body.list) do
|
|
||||||
state.projects.list[#state.projects.list + 1] = value
|
|
||||||
end
|
|
||||||
|
|
||||||
state.projects.last = body.last
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
elseif state.save.method == "lua" then
|
elseif state.save.method == "lua" then
|
||||||
local f = io.open(state.save.lua_save_path, "r")
|
local f = io.open(state.save.lua_save_path, "r")
|
||||||
if not f then
|
if f then
|
||||||
return
|
state.projects = json.decode(f:read("*a"))
|
||||||
end
|
|
||||||
local projects = json.decode(f:read("*a")) or _get_default_projects()
|
|
||||||
io.close(f)
|
io.close(f)
|
||||||
state.projects = projects
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not state.projects then
|
||||||
|
state.projects = _get_default_projects()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -799,7 +793,7 @@ local _merge_event = ya.sync(function(state)
|
|||||||
_notify(message)
|
_notify(message)
|
||||||
end
|
end
|
||||||
elseif opt == "current" then
|
elseif opt == "current" then
|
||||||
local tab = body.tabs[tostring(body.active_idx)]
|
local tab = body.tabs[tonumber(body.active_idx)]
|
||||||
_merge_tab(tab)
|
_merge_tab(tab)
|
||||||
|
|
||||||
if state.notify.enable then
|
if state.notify.enable then
|
||||||
|
|||||||
Reference in New Issue
Block a user