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
Bug fixes in dnd.c:
- mktempdir_in_cache: add missing 'return ans' after successful strdup
- mktempdir_in_cache (utils.py): use O_RDONLY instead of O_RDWR for directories
- remote_items allocation: use mi.num_uris instead of ds.num_mimes
- Off-by-one: uri_item_idx > changed to >= for bounds checks
- Off-by-one: entry_num > changed to >= for bounds checks
- populate_dir_entries: fix missing last entry after final null separator
- add_payload directory finalization: create directory on disk with mkdirat
- get_errno_name: add EFBIG, EISDIR, ENOSPC error codes
Test infrastructure:
- Add dnd_test_force_drag_dropped() to simulate DROPPED state
- Make notify_drag_data_ready() succeed in test mode
Comprehensive t=k tests added:
- Single file, empty file, single symlink transfer
- Chunked file transfer with m=1
- Single directory with children
- Directory with symlinks
- Multiple URIs
- Deep directory trees (breadth-first and depth-first, 3+ levels)
- Mixed file/dir/symlink at top level
- Completion signal
- Error handling (client errors, invalid state)
- DoS limits (REMOTE_DRAG_LIMIT, PRESENT_DATA_CAP)
- Invalid input (bad base64, too large chunks, invalid indices/handles)
- URI list with comments
- Multiple chunks for directory listing
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/9da0bff7-6a1a-490f-a4c5-8cb328e056ce
Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
Bug 1: remote_items allocation used ds.num_mimes instead of mi.num_uris
Bug 2: Off-by-one in uri_item_idx > mi.num_uris (should be >=)
Bug 3: Off-by-one in entry_num > parent->children_sz (should be >=)
Bug 4: DRAG_SOURCE_DROPPED state never set in drag_notify
Also add dnd_test_force_drag_dropped() helper and make
notify_drag_data_ready() succeed in test mode.
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/9da0bff7-6a1a-490f-a4c5-8cb328e056ce
Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>