fix: selector preview (#2362)

This commit is contained in:
yetone
2025-06-28 20:07:25 +08:00
committed by GitHub
parent e2d160aa83
commit e64b5f054c
4 changed files with 37 additions and 0 deletions

View File

@@ -221,6 +221,11 @@ function FileSelector:show_selector_ui()
selected_item_ids = self.selected_filepaths,
provider_opts = Config.file_selector.provider_opts,
on_select = function(item_ids) self:handle_path_selection(item_ids) end,
get_preview_content = function(item_id)
local content = Utils.read_file_from_buf_or_disk(item_id)
local filetype = Utils.get_filetype(item_id)
return table.concat(content or {}, "\n"), filetype
end,
})
selector:open()
end
@@ -233,6 +238,11 @@ function FileSelector:show_selector_ui()
selected_item_ids = self.selected_filepaths,
provider_opts = Config.selector.provider_opts,
on_select = function(item_ids) self:handle_path_selection(item_ids) end,
get_preview_content = function(item_id)
local content = Utils.read_file_from_buf_or_disk(item_id)
local filetype = Utils.get_filetype(item_id)
return table.concat(content or {}, "\n"), filetype
end,
})
selector:open()
end