-
Notifications
You must be signed in to change notification settings - Fork 92
Description
Problem
When rendering inline images that overlap existing buffer content (e.g. a diagram rendered on top of its source code block), image.nvim always reserves the full image height as virtual padding. This pushes content below the image further down than necessary, since some of that space is already occupied by buffer lines.
There's also no way to use negative render_offset_top values to shift an image upward — the current code guards with > 0 checks.
Proposed solution
-
New
overlapoption infrom_file(): specifies how many buffer lines the image covers. The extmark virtual padding is reduced by this amount:math.max(0, height + render_offset_top - overlap + 1). When the image is taller than the overlapped lines, only the excess gets virtual padding. When it's shorter, no virtual padding is added. -
Support negative
render_offset_top: simplify the> 0guards inrenderer.luato always apply the offset (defaulting to 0), enabling upward shifts.
Use case
diagram.nvim can count the lines in a code fence block and pass that as overlap, so rendered diagrams overlay their source code without pushing subsequent content down.