From 5f02bb1547ac1f2851edfb9d4ddd9721bf585d13 Mon Sep 17 00:00:00 2001 From: Harry Porter-Mills Date: Fri, 24 Apr 2026 12:03:58 -0400 Subject: [PATCH] fix: include render_offset_top in virtual padding reservation When an image is rendered with both with_virtual_padding=true and render_offset_top > 0, the rendered image is shifted down by render_offset_top cells (renderer.lua:200) but the extmark virt_lines reservation only accounts for the image height. The result is that the last render_offset_top rows of the image overlap real buffer content immediately below the reserved area. The total_height value (height + render_offset_top) was already being computed for the cache-invalidation key on the same code path, so it can be reused for the reservation itself. Fixes #355 --- lua/image/image.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/image/image.lua b/lua/image/image.lua index 9108084..ceafbf6 100644 --- a/lua/image/image.lua +++ b/lua/image/image.lua @@ -121,8 +121,9 @@ function Image:render(geometry) local filler = {} local extmark_opts = { id = self.internal_id, strict = false } if self.with_virtual_padding then - -- only reserve real height for the extmark, padding is applied during rendering - local total_lines = height + -- reserve image height plus render_offset_top, since the offset + -- shifts the rendered image down without removing any of its rows + local total_lines = total_height for _ = 0, total_lines - 1 do filler[#filler + 1] = { { " ", "" } } end