From 392b6882c3ad4e5524df629f0e8246db42b84bd4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 3 May 2026 08:00:38 +0000 Subject: [PATCH] Add comment explaining data_capacity/data_size reset in finish_remote_data Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/fdd92dca-f2f9-4bb6-9d85-b5daeaa501f7 Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com> --- kitty/dnd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kitty/dnd.c b/kitty/dnd.c index 9c3ce866a..eb6dab52e 100644 --- a/kitty/dnd.c +++ b/kitty/dnd.c @@ -1745,6 +1745,8 @@ finish_remote_data(Window *w, size_t item_idx) { new_size += 2; } free(ds.items[item_idx].uri_list); ds.items[item_idx].uri_list = NULL; ds.items[item_idx].num_uris = 0; + // The fd has been completely rewritten with updated (cached) URIs; update the read tracking + // fields so drag_get_data returns the full new content starting from the beginning. ds.items[item_idx].data_capacity = new_size; ds.items[item_idx].data_size = 0; int ret = dnd_is_test_mode() ? 0 : notify_drag_data_ready(global_state.drag_source.from_os_window, ds.items[item_idx].mime_type);