Repository navigation
Conversation
With laststatus=2, a normal window never showed an image in its last row, and an image whose top was on that row was sent with a crop height of 0, which the kitty protocol reads as the whole image, so it was drawn over the statusline and the command line. get_windows() took a row off rect.bottom for the statusline, but nvim_win_get_height() already excludes it. The renderer's own bounds.bottom - 1 then turned that into the second-to-last row, and the out-of-bounds check added laststatus_offset back, so an image one row below the bounds still counted as visible and was cropped to 0 rows. rect.bottom is now top + height for every laststatus, and is_below compares against the bounds alone. Fixes 3rd#383
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #383.
With
laststatus=2, a normal window never showed an image in its last row. An image whose top was on that row was sent with a crop height of 0, which the kitty protocol reads as the whole image, so it was drawn over the statusline and command line.laststatus=0and3were fine.Cause
Two terms applied only when
laststatus == 2:get_windows()took a row offrect.bottomfor the statusline, butnvim_win_get_height()already excludes it. The renderer'sbounds.bottom - 1, which turns the exclusive bottom into the last row, then counted that row a second time.is_belowadded the row back (+ laststatus_offset), so an image one row below the bounds still counted as visible and was cropped to(bounds.bottom - y + 1) = 0rows.Change
lua/image/utils/window.lua:rect.bottom = rect_top + content_heightfor everylaststatus. This also makes the float-overlap masks, which already treatrect.bottomas exclusive, correct for the last row.lua/image/renderer.lua:is_below = absolute_y > bounds.bottom, with the now-unusedlaststatus_offsetremoved. The renderer's- 1stays.Fixing only
window.luawould bring back the statusline overdraw, becauseis_belowwould still let an image that starts on the statusline row through. One of the new tests covers that.Tests
tests/utils/window_spec.lua: a normal window'srect.bottomistop + heightforlaststatus0, 2 and 3.tests/renderer/bottom_bounds_spec.lua: in a real window, a 3-row image whose top is on the window's third-to-last, second-to-last and last row is shown with 3, 2 and 1 rows, and one that starts below the window is not rendered, forlaststatus0, 2 and 3.Without the fix, the
laststatus=2cases fail (2rows instead of3, andrect.bottom19 instead of 20). With it, the full suite passes (103/103, busted + nlua on Lua 5.1, as in CI).Verified live
This is the repro from #383, kitty backend, Ghostty inside tmux.
display_heightis in rows at 32 px cells:laststatusBoth
laststatusterms came from #180 (for #179, an image over the statusline withlaststatus=2). The renderer's- 1already keeps images off the statusline, and the last-row case above shows it: the image there is drawn 1 row tall, not over the statusline.