Fix failing test

This commit is contained in:
Kovid Goyal 2026-05-02 17:16:27 +05:30
parent d3114ec948
commit a87441b91a
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
4 changed files with 24 additions and 4 deletions

View file

@ -26,6 +26,8 @@ Subsequent chunks may optionally omit all
metadata except the ``m`` and ``i`` keys. While a chunked transfer is in
progress it is a protocol error to for the sending side to
send any protocol related escape codes other than chunked ones.
In particular, this means that the receiving side should use the metadata from
the first chunk in a chain of chunks only.
All integer values used in this escape code must be 32-bit signed or unsigned
integers encoded in decimal representation.

View file

@ -176,6 +176,7 @@ static Line* range_line_(Screen *self, int y);
void
screen_reset(Screen *self) {
screen_pause_rendering(self, false, 0);
self->dnd_chunking.active = false;
self->extra_cursors.count = 0; zero_at_ptr(&self->extra_cursors.color); self->extra_cursors.dirty = true;
self->main_pointer_shape_stack.count = 0; self->alternate_pointer_shape_stack.count = 0;
if (self->linebuf == self->alt_linebuf) screen_toggle_screen_buffer(self, true, true);
@ -1523,10 +1524,22 @@ screen_mark_potential_url_drag(Screen *self) {
}
void
screen_handle_dnd_command(Screen *self, const DnDCommand *cmd, const uint8_t *payload) {
if (!self->window_id) return;
Window *w = window_for_window_id(self->window_id);
if (!w) return;
screen_handle_dnd_command(Screen *self, const DnDCommand *cmd_, const uint8_t *payload) {
Window *w;
if (!self->window_id || !(w = window_for_window_id(self->window_id))) return;
const DnDCommand *cmd; DnDCommand copy;
if (self->dnd_chunking.active) {
copy = self->dnd_chunking.metadata;
copy.more = cmd_->more; copy.payload_sz = cmd_->payload_sz;
cmd = ©
self->dnd_chunking.active = cmd->more != 0;
} else {
cmd = cmd_;
if (cmd_->more) {
self->dnd_chunking.active = true;
self->dnd_chunking.metadata = *cmd_;
}
}
switch(cmd->type) {
case 'a':
if (cmd->cell_x == 1) drop_register_machine_id(w, payload, cmd->payload_sz);

View file

@ -207,6 +207,10 @@ typedef struct {
ListOfChars *lc;
monotonic_t parsing_at;
ExtraCursors extra_cursors;
struct {
bool active;
DnDCommand metadata;
} dnd_chunking;
} Screen;
#define pixel_scroll_enabled(screen) (OPT(pixel_scroll) && !screen->paused_rendering.expires_at && screen->linebuf == screen->main_linebuf)

View file

@ -339,6 +339,7 @@ class TestDnDKitten(BaseTest):
self.img_drag_data = None
def read_drag_data(self, mime):
# self.pty.log_data_flow = True
ans = b''
while True:
try: