mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-30 13:24:19 +00:00
Only move graphics on resize if the actual num of content lines chages
Avoids spurious moves when the window is not full and therefore text does not move on vertical resize
This commit is contained in:
parent
a720ef6917
commit
046eb86091
3 changed files with 6 additions and 6 deletions
|
|
@ -1791,11 +1791,11 @@ handle_delete_command(GraphicsManager *self, const GraphicsCommand *g, Cursor *c
|
|||
// }}}
|
||||
|
||||
void
|
||||
grman_resize(GraphicsManager *self, index_type old_lines, index_type lines, index_type old_columns, index_type columns) {
|
||||
grman_resize(GraphicsManager *self, index_type old_lines UNUSED, index_type lines UNUSED, index_type old_columns, index_type columns, index_type num_content_lines_before, index_type num_content_lines_after) {
|
||||
ImageRef *ref; Image *img;
|
||||
self->layers_dirty = true;
|
||||
if (columns == old_columns && old_lines > lines) {
|
||||
const unsigned int vertical_shrink_size = old_lines - lines;
|
||||
if (columns == old_columns && num_content_lines_before > num_content_lines_after) {
|
||||
const unsigned int vertical_shrink_size = num_content_lines_before - num_content_lines_after;
|
||||
for (size_t i = self->image_count; i-- > 0;) {
|
||||
img = self->images + i;
|
||||
for (size_t j = img->refcnt; j-- > 0;) {
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ const char* grman_handle_command(GraphicsManager *self, const GraphicsCommand *g
|
|||
Image* grman_put_cell_image(GraphicsManager *self, uint32_t row, uint32_t col, uint32_t image_id, uint32_t placement_id, uint32_t x, uint32_t y, uint32_t w, uint32_t h, CellPixelSize cell);
|
||||
bool grman_update_layers(GraphicsManager *self, unsigned int scrolled_by, float screen_left, float screen_top, float dx, float dy, unsigned int num_cols, unsigned int num_rows, CellPixelSize);
|
||||
void grman_scroll_images(GraphicsManager *self, const ScrollData*, CellPixelSize fg);
|
||||
void grman_resize(GraphicsManager*, index_type, index_type, index_type, index_type);
|
||||
void grman_resize(GraphicsManager*, index_type, index_type, index_type, index_type, index_type, index_type);
|
||||
void grman_rescale(GraphicsManager *self, CellPixelSize fg);
|
||||
void grman_remove_cell_images(GraphicsManager *self, int32_t top, int32_t bottom);
|
||||
void grman_remove_all_cell_images(GraphicsManager *self);
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ screen_resize(Screen *self, unsigned int lines, unsigned int columns) {
|
|||
/* printf("old_cursor: (%u, %u) new_cursor: (%u, %u) beyond_content: %d\n", self->cursor->x, self->cursor->y, cursor.after.x, cursor.after.y, cursor.is_beyond_content); */
|
||||
setup_cursor(main_saved_cursor);
|
||||
grman_remove_all_cell_images(self->main_grman);
|
||||
grman_resize(self->main_grman, self->lines, lines, self->columns, columns);
|
||||
grman_resize(self->main_grman, self->lines, lines, self->columns, columns, num_content_lines_before, num_content_lines_after);
|
||||
|
||||
// Resize alt linebuf
|
||||
n = realloc_lb(self->alt_linebuf, lines, columns, &num_content_lines_before, &num_content_lines_after, NULL, &cursor, &alt_saved_cursor, &self->as_ansi_buf);
|
||||
|
|
@ -398,7 +398,7 @@ screen_resize(Screen *self, unsigned int lines, unsigned int columns) {
|
|||
if (!is_main) setup_cursor(cursor);
|
||||
setup_cursor(alt_saved_cursor);
|
||||
grman_remove_all_cell_images(self->alt_grman);
|
||||
grman_resize(self->alt_grman, self->lines, lines, self->columns, columns);
|
||||
grman_resize(self->alt_grman, self->lines, lines, self->columns, columns, num_content_lines_before, num_content_lines_after);
|
||||
#undef setup_cursor
|
||||
|
||||
self->linebuf = is_main ? self->main_linebuf : self->alt_linebuf;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue