Updating state.curr_dir on hover + added initial state to it

This commit is contained in:
Diogo Duarte
2024-03-31 16:33:45 +01:00
parent 914444c097
commit b5674166db

View File

@@ -81,6 +81,12 @@ local delete_all_bookmarks = ya.sync(function(state)
end)
local _save_last_dir = ya.sync(function(state)
state.curr_dir = {
on = "'",
desc = "~", -- FIX This might not be true, i.e. the user entry point might not be the home dir
cursor = 0,
}
ps.sub("cd", function()
local folder = Folder:by_kind(Folder.CURRENT)
state.last_dir = state.curr_dir
@@ -90,6 +96,11 @@ local _save_last_dir = ya.sync(function(state)
cursor = folder.cursor,
}
end)
ps.sub("hover", function()
local folder = Folder:by_kind(Folder.CURRENT)
state.curr_dir.cursor = folder.cursor
end)
end)
return {