diff --git a/docs/dnd-protocol.rst b/docs/dnd-protocol.rst index 7b5cef9d2..d4aec9d7e 100644 --- a/docs/dnd-protocol.rst +++ b/docs/dnd-protocol.rst @@ -297,14 +297,18 @@ form:: This, is the data for the MIME type identified by ``idx`` which is a zero based index into the list of MIME types. The data should be chunkedusing the -``m`` key. End of data is denoted by ``m=0`` and an rmpty payload. If an error +``m`` key. End of data is denoted by ``m=0`` and an empty payload. If an error occurs the client should send:: - OSC _dnd_code ; t=E; ERR_CODE ST + OSC _dnd_code ; t=E:y=idx ; ERR_CODE ST Where ``ERR_CODE`` is a POSIX error code such as ``ENOENT`` if the MIME type is not found or ``EIO`` if an IO error occurred and so on. +If the client wants to cancel the full drag at any time, it should send: + + OSC _dnd_code ; t=E:y=-1 ST + Multiplexers ----------------- diff --git a/kitty/screen.c b/kitty/screen.c index d764a6bd8..c0e8864b2 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -1570,7 +1570,12 @@ screen_handle_dnd_command(Screen *self, const DnDCommand *cmd, const uint8_t *pa drag_process_item_data(w, cmd->cell_y, cmd->more, payload, cmd->payload_sz); } break; case 'E': { - drag_process_item_data(w, cmd->cell_y, -1, payload, cmd->payload_sz); + if (cmd->cell_y == -1) { + drag_free_offer(w); + if (global_state.drag_source.is_active && global_state.drag_source.from_window == w->id) { + cancel_current_drag_source(); + } + } else drag_process_item_data(w, cmd->cell_y, -1, payload, cmd->payload_sz); } break; } }