Fix newly displayed images sometimes not being rendered until the next redraw

prepare_to_render_os_window() decided whether a window needs to be rendered
in layers before calling send_cell_data_to_gpu(), which is what updates the
graphics layers. So on the frame in which an image first becomes visible
grman_has_images() returned a stale false, the window was rendered without
the image, and if nothing else triggered a redraw (for example, the cursor
is hidden so not blinking) the image did not appear until some unrelated
event such as mouse movement.

Fixes #10875
This commit is contained in:
Kovid Goyal 2026-11-16 07:45:22 +05:30
parent 2b260d8d67
commit ec28187f6f
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 1 deletions

View file

@ -168,6 +168,10 @@ Detailed list of changes
:code:`--base-dir` into account, and file name completion is relative to that
directory (:pull:`10851`, :pull:`10852`, :disc:`10867`)
- Graphics protocol: Fix a newly displayed image sometimes not being rendered
until something else, such as mouse movement, causes the window to be redrawn
(:iss:`10875`)
- Fix the scrolled back view jumping, and images, the cursor and the scrollbar
getting out of sync with the text, when new output arrives
(:pull:`10841`, :pull:`10847`)

View file

@ -946,7 +946,6 @@ prepare_to_render_os_window(
Window *w = tab->windows + i;
#define WD w->render_data
if (w->visible && WD.screen) {
os_window->needs_layers = os_window->needs_layers || screen_needs_rendering_in_layers(os_window, w, WD.screen);
screen_check_pause_rendering(WD.screen, now);
*num_visible_windows += 1;
color_type window_bg =
@ -1037,6 +1036,10 @@ prepare_to_render_os_window(
}
}
if (send_cell_data_to_gpu(WD.vao_idx, WD.screen, os_window)) needs_render = true;
// Must be after send_cell_data_to_gpu() as that updates the graphics layers, which
// determine whether there are images that need rendering in layers. Otherwise, a newly
// placed image is not drawn until something else causes a re-render, see #10875
os_window->needs_layers = os_window->needs_layers || screen_needs_rendering_in_layers(os_window, w, WD.screen);
if (WD.screen->start_visual_bell_at | WD.screen->start_drag_overlay_at) needs_render = true;
if (OPT(progress_bar) != PROGRESS_BAR_HIDDEN && WD.screen->progress_state == PROGRESS_STATE_INDETERMINATE) needs_render = true;
// Prepare window title bar screen data for GPU