Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lua/image/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ local backend_modules = {
sixel = "image/backends/sixel",
}

---@return string
local winborder_or_fallback = function()
if vim.o.winborder == "" then return "single" end
return vim.o.winborder
end

---@type Options
local default_options = {
-- backend = "ueberzug",
Expand Down Expand Up @@ -53,6 +59,7 @@ local default_options = {
max_height = nil,
max_width_window_percentage = 100,
max_height_window_percentage = 50,
popup_border = winborder_or_fallback(),
scale_factor = 1.0,
kitty_method = "normal",
kitty_direct_chunk_size = 4096,
Expand Down
6 changes: 3 additions & 3 deletions lua/image/utils/document.lua
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ local create_document_integration = function(config)
return should_render_match(ctx, window, item.match, cursor_row)
end

local render_popup_image = function(image)
local render_popup_image = function(image, popup_border)
if popup_window ~= nil then return end

local term_size = utils.term.get_size()
Expand All @@ -155,7 +155,7 @@ local create_document_integration = function(config)
width = width,
height = height,
style = "minimal",
border = "single",
border = popup_border,
}
local buf = vim.api.nvim_create_buf(false, true)
vim.bo[buf].filetype = "image_nvim_popup"
Expand Down Expand Up @@ -192,7 +192,7 @@ local create_document_integration = function(config)
local render_image = function(ctx, item, image)
log.debug("render_image called", { id = image.id })
if ctx.options.only_render_image_at_cursor and ctx.options.only_render_image_at_cursor_mode == "popup" then
render_popup_image(image)
render_popup_image(image, ctx.state.options.popup_border)
return
end

Expand Down