From: Eli Zaretskii Date: Sat, 13 Mar 2021 15:00:15 +0000 (+0200) Subject: Fix rare redisplay glitches when image has been removed from display X-Git-Tag: emacs-28.0.90~3287 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1f0fb1f6fa50faf67ffaaee0e52d00144883821e;p=emacs.git Fix rare redisplay glitches when image has been removed from display * src/dispnew.c (update_window): Make sure all glyph rows below the last visible one are marked as invalid, even when the loop which "updates the rest of the lines" didn't examine the last visible row. (Bug#47093) --- diff --git a/src/dispnew.c b/src/dispnew.c index b3e4587250f..f613f7b6568 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3588,6 +3588,7 @@ update_window (struct window *w, bool force_p) int yb; bool changed_p = 0, mouse_face_overwritten_p = 0; int n_updated = 0; + bool invisible_rows_marked = false; #ifdef HAVE_WINDOW_SYSTEM gui_update_window_begin (w); @@ -3679,13 +3680,36 @@ update_window (struct window *w, bool force_p) tempted to optimize redisplay based on lines displayed in the first redisplay. */ if (MATRIX_ROW_BOTTOM_Y (row) >= yb) - for (i = vpos + 1; i < w->current_matrix->nrows - 1; ++i) - SET_MATRIX_ROW_ENABLED_P (w->current_matrix, i, false); + { + for (i = vpos + 1; i < w->current_matrix->nrows - 1; ++i) + SET_MATRIX_ROW_ENABLED_P (w->current_matrix, i, false); + invisible_rows_marked = true; + } } /* Was display preempted? */ paused_p = row < end; + if (!paused_p && !invisible_rows_marked) + { + /* If we didn't mark the invisible rows in the current + matrix as invalid above, do that now. This can happen if + scrolling_window updates the last visible rows of the + current matrix, in which case the above loop doesn't get + to examine the last visible row. */ + int i; + for (i = 0; i < w->current_matrix->nrows - 1; ++i) + { + struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, i); + if (current_row->enabled_p + && MATRIX_ROW_BOTTOM_Y (current_row) >= yb) + { + for (++i ; i < w->current_matrix->nrows - 1; ++i) + SET_MATRIX_ROW_ENABLED_P (w->current_matrix, i, false); + } + } + } + set_cursor: /* Update the tab line after scrolling because a new tab