Graphics: Move images up along with text when the window is shrunk vertically

Fixes #6278
This commit is contained in:
Kovid Goyal 2023-05-24 15:18:58 +05:30
parent b45d7ae21f
commit a720ef6917
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 15 additions and 1 deletions

View file

@ -67,6 +67,8 @@ Detailed list of changes
- ssh kitten: Fix a regression in 0.28.0 that caused interrupt during setup to not be handled gracefully (:iss:`6254`)
- Graphics: Move images up along with text when the window is shrunk vertically (:iss:`6278`)
0.28.1 [2023-04-21]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -1791,8 +1791,20 @@ handle_delete_command(GraphicsManager *self, const GraphicsCommand *g, Cursor *c
// }}}
void
grman_resize(GraphicsManager *self, index_type UNUSED old_lines, index_type UNUSED lines, index_type UNUSED old_columns, index_type UNUSED columns) {
grman_resize(GraphicsManager *self, index_type old_lines, index_type lines, index_type old_columns, index_type columns) {
ImageRef *ref; Image *img;
self->layers_dirty = true;
if (columns == old_columns && old_lines > lines) {
const unsigned int vertical_shrink_size = old_lines - lines;
for (size_t i = self->image_count; i-- > 0;) {
img = self->images + i;
for (size_t j = img->refcnt; j-- > 0;) {
ref = img->refs + j;
if (ref->is_virtual_ref || ref->is_cell_image) continue;
ref->start_row -= vertical_shrink_size;
}
}
}
}
void