From 3a64b835fb7a55f041e2ce7a5bc49e37668eacbd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 26 Feb 2020 07:28:39 +0530 Subject: [PATCH] DRYer --- kitty/screen.c | 2 +- kitty/screen.h | 2 +- kitty/shaders.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kitty/screen.c b/kitty/screen.c index 2253bf570..5efb8a596 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -1541,7 +1541,7 @@ screen_update_cell_data(Screen *self, void *address, FONTS_DATA_HANDLE fonts_dat lnum = y - self->scrolled_by; linebuf_init_line(self->linebuf, lnum); if (self->linebuf->line->has_dirty_text || - (cursor_has_moved && (self->cursor->y == lnum || self->last_rendered_cursor_y == lnum))) { + (cursor_has_moved && (self->cursor->y == lnum || self->last_rendered.cursor_y == lnum))) { render_line(fonts_data, self->linebuf->line, lnum, self->cursor, self->disable_ligatures); if (self->linebuf->line->has_dirty_text && screen_has_marker(self)) mark_text_in_line(self->marker, self->linebuf->line); diff --git a/kitty/screen.h b/kitty/screen.h index dd3ce1769..e500b335c 100644 --- a/kitty/screen.h +++ b/kitty/screen.h @@ -76,7 +76,6 @@ typedef struct { PyObject_HEAD unsigned int columns, lines, margin_top, margin_bottom, charset, scrolled_by, last_selection_scrolled_by; - unsigned int last_rendered_cursor_x, last_rendered_cursor_y; double pending_scroll_pixels; CellPixelSize cell_size; OverlayLine overlay_line; @@ -86,6 +85,7 @@ typedef struct { Selection selection, url_range; struct { IterationData selection, url; + unsigned int cursor_x, cursor_y; } last_rendered; bool use_latin1, selection_updated_once, is_dirty, scroll_changed, reload_all_gpu_data; Cursor *cursor; diff --git a/kitty/shaders.c b/kitty/shaders.c index 18b7cc023..550b6a4c6 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -315,8 +315,8 @@ cell_prepare_to_render(ssize_t vao_idx, ssize_t gvao_idx, Screen *screen, GLfloa ensure_sprite_map(fonts_data); - bool cursor_pos_changed = screen->cursor->x != screen->last_rendered_cursor_x - || screen->cursor->y != screen->last_rendered_cursor_y; + bool cursor_pos_changed = screen->cursor->x != screen->last_rendered.cursor_x + || screen->cursor->y != screen->last_rendered.cursor_y; bool disable_ligatures = screen->disable_ligatures == DISABLE_LIGATURES_CURSOR; if (screen->reload_all_gpu_data || screen->scroll_changed || screen->is_dirty || (disable_ligatures && cursor_pos_changed)) { @@ -328,8 +328,8 @@ cell_prepare_to_render(ssize_t vao_idx, ssize_t gvao_idx, Screen *screen, GLfloa } if (cursor_pos_changed) { - screen->last_rendered_cursor_x = screen->cursor->x; - screen->last_rendered_cursor_y = screen->cursor->y; + screen->last_rendered.cursor_x = screen->cursor->x; + screen->last_rendered.cursor_y = screen->cursor->y; } if (screen->reload_all_gpu_data || screen_is_selection_dirty(screen)) {