Clarify that end of drop escape code discards queued requests

This commit is contained in:
Kovid Goyal 2026-04-26 22:34:30 +05:30
parent db2d5e0111
commit 9acc16cc44
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 4 additions and 24 deletions

View file

@ -127,7 +127,8 @@ send an escape code of the form::
OSC _dnd_code ; t=r ST
That is, it must send a request for data with no MIME type specified. The
terminal emulator must then inform the OS that the drop is completed.
terminal emulator must then inform the OS that the drop is completed. Any
queued data requests must be discarded by the terminal.
Dropping from remote machines
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1145,9 +1145,9 @@ drop_process_queue(Window *w) {
void
drop_enqueue_request(Window *w, int32_t cell_x, int32_t cell_y, int32_t pixel_y) {
/* Handle finish (x=0, y=0, Y=0): if there are no in-flight requests, finish immediately */
if (cell_x == 0 && cell_y == 0 && pixel_y == 0 && w->drop.num_data_requests == 0) {
if (cell_x == 0 && cell_y == 0 && pixel_y == 0) { // drop finished
drop_finish_and_clear_queue(w);
reset_drop(w);
return;
}

View file

@ -2242,27 +2242,6 @@ def test_mixed_request_types_processed_in_order(self) -> None:
finally:
os.unlink(fpath)
def test_finish_after_queued_requests(self) -> None:
"""A finish (empty t=r) after queued requests processes remaining then finishes."""
with dnd_test_window() as (screen, cap):
self._register_for_drops(screen, cap, 'text/plain')
dnd_test_set_mouse_pos(cap.window_id, 0, 0, 0, 0)
dnd_test_fake_drop_event(cap.window_id, True, ['text/plain'])
cap.consume()
# Queue: data request then finish
parse_bytes(screen, client_request_data(1))
parse_bytes(screen, client_request_data()) # finish
# Serve the data request
dnd_test_fake_drop_data(cap.window_id, 'text/plain', b'data before finish')
raw = cap.consume()
events = parse_escape_codes_b64(raw)
r_events = [e for e in events if e['type'] == 'r']
self.assertTrue(r_events, 'no t=r events')
for ev in r_events:
self.ae(ev['meta'].get('x'), '1')
def test_multiple_sync_errors_processed_immediately(self) -> None:
"""Multiple queued requests that all fail synchronously are processed immediately."""
with dnd_test_window() as (screen, cap):