From 3663e13b199f00eac522be13c84a11ccf95c3b55 Mon Sep 17 00:00:00 2001 From: Diogo Duarte Date: Fri, 26 Apr 2024 15:42:32 +0100 Subject: [PATCH] Fix for when folder.window is nil --- init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 8527066..aa3196f 100644 --- a/init.lua +++ b/init.lua @@ -33,9 +33,13 @@ local _get_real_index = ya.sync(function(state, idx) return nil end) -local _get_hovered_file = ya.sync(function () +local _get_hovered_file = ya.sync(function() local folder = Folder:by_kind(Folder.CURRENT) - return folder.window[folder.cursor - folder.offset + 1].url + local file_hovered = folder.window[folder.cursor - folder.offset + 1] + if not file_hovered then + return folder.cwd + end + return file_hovered.url end) local _load_state = ya.sync(function(state)