screen_draw_overlay_line accessed self->linebuf->line->cpu_cells
without ever calling linebuf_init_line on the shared view. Render
paths that initialize a stack-local Line via render_line_for_virtual_y
left the view's cpu_cells as NULL (the value set by alloc_line via
PyType_GenericAlloc), and the multicell-trim loop then dereferenced
NULL + xstart * sizeof(CPUCell), producing a SIGSEGV at a small
address (e.g. 0x1e for xstart=2). The crash was reachable any time
an IME pre-edit overlay was rendered with the cursor not in column 0
on a screen whose linebuf->line had not been re-pointed by some
unrelated prior call.
Fix by initializing the view at the overlay row on entry. Add a
test_draw_overlay_line method on Screen so the behavior can be
exercised directly from a regression test.
When toggling between alt and main screen buffers, the selection buffer
(is_selected) was not always re-uploaded to the GPU. This caused a size
mismatch because render_lines_for_screen depends on pixel_scroll_enabled,
which depends on linebuf == main_linebuf.
On alt screen, pixel_scroll is disabled so render_lines = screen->lines.
On main screen, pixel_scroll is enabled so render_lines = screen->lines + 1.
After switching from alt to main, the cell data buffer was re-uploaded with
the larger size (is_dirty = true), but the selection buffer was not
(screen_is_selection_dirty could return false if no selections/urls/extra
cursors were active). The extra row of cells then read out-of-bounds from
the selection buffer, getting garbage data that the shader interpreted as
extra cursor shapes, producing blinking cursor-colored artifacts.
Fix by unconditionally setting extra_cursors.dirty = true after screen
toggle, ensuring the selection buffer is always re-uploaded with the
correct size matching the cell data buffer.
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/daa73124-4795-4389-aea5-bb5593a26d9f
Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
We dont bother with configurable ttl. Instead treat the start of caching
as the instant when cache freshness is checked. And ensure that cache is
re-used for every OS Window.
Fixes#9862Fixes#9872