From 269e04fa1b9aa864c95dbcf74baedb588269bc78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 26 Jul 2019 18:50:41 +0200 Subject: [PATCH] render: flush glyph sequence after erase previous cursor If not, we may have scrolled when we later flush the glyph sequence, causing the glyph to be rendered in wrong location. --- render.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/render.c b/render.c index 4a0e426e..c2610558 100644 --- a/render.c +++ b/render.c @@ -56,6 +56,9 @@ color_dim(struct rgb *rgb) static void gseq_flush(struct terminal *term, struct buffer *buf) { + if (gseq.count == 0) + return; + struct rgb fg = color_hex_to_rgb(gseq.foreground); if (gseq.attrs.dim) @@ -392,6 +395,9 @@ grid_render(struct terminal *term) term->render.last_cursor.in_view.col, term->render.last_cursor.in_view.row, false); + /* Must flush now since scroll damage will shift the entire pixmap */ + gseq_flush(term, buf); + wl_surface_damage_buffer( term->wl.surface, term->render.last_cursor.in_view.col * term->cell_width, @@ -540,15 +546,13 @@ grid_render(struct terminal *term) term->cell_width, term->cell_height); } + gseq_flush(term, buf); + if (all_clean) { buf->busy = false; - gseq_flush(term, buf); return; } - if (gseq.count > 0) - gseq_flush(term, buf); - if (term->flash.active) { cairo_set_source_rgba(buf->cairo, 1.0, 1.0, 0.0, 0.5); cairo_set_operator(buf->cairo, CAIRO_OPERATOR_OVER);