Fixed issue where multiple bookmarks where being created for the same key

This commit is contained in:
Diogo Duarte
2024-03-29 18:08:41 +00:00
parent 56b4742bac
commit 0576dd5f75

View File

@@ -18,7 +18,14 @@ local save_bookmark = ya.sync(function(state, idx)
local folder = Folder:by_kind(Folder.CURRENT) local folder = Folder:by_kind(Folder.CURRENT)
state.bookmarks = state.bookmarks or {} state.bookmarks = state.bookmarks or {}
state.bookmarks[#state.bookmarks + 1] = { state.indexes = state.indexes or {}
local _idx = state.indexes[idx]
if _idx == nil then
_idx = #state.bookmarks + 1
state.indexes[idx] = _idx
end
state.bookmarks[_idx] = {
on = SUPPORTED_KEYS[idx].on, on = SUPPORTED_KEYS[idx].on,
desc = tostring(folder.cwd), desc = tostring(folder.cwd),
cursor = folder.cursor, cursor = folder.cursor,