From d10681f27f088de864681584dd02696ab056354a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 Dec 2020 18:31:30 +0530 Subject: [PATCH] Send responses when only a number and no id is specified --- kitty/graphics.c | 5 +++-- kitty_tests/graphics.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kitty/graphics.c b/kitty/graphics.c index fb6ee25dd..69c027320 100644 --- a/kitty/graphics.c +++ b/kitty/graphics.c @@ -520,14 +520,15 @@ finish_command_response(const GraphicsCommand *g, bool data_loaded, uint32_t iid if (g->quiet) { if (is_ok_response || g->quiet > 1) return NULL; } - if (iid) { + if (iid || image_number) { if (is_ok_response) { if (!data_loaded) return NULL; snprintf(command_response, 10, "OK"); } size_t pos = 0; + rbuf[pos++] = 'G'; #define print(fmt, ...) pos += snprintf(rbuf + pos, arraysz(rbuf) - 1 - pos, fmt, __VA_ARGS__) - print("Gi=%u", iid); + if (iid) print("i=%u", iid); if (image_number) print(",I=%u", image_number); if (placement_id) print(",p=%u", placement_id); print(";%s", command_response); diff --git a/kitty_tests/graphics.py b/kitty_tests/graphics.py index 1342976e8..7a5c2a81b 100644 --- a/kitty_tests/graphics.py +++ b/kitty_tests/graphics.py @@ -277,7 +277,8 @@ class TestGraphics(BaseTest): code, idstr = put(c=2, r=2, I=93) self.ae((code, idstr), ('OK', 'i=6,I=93')) - self.assertIsNone(put(c=2, r=2, I=94)) + code, idstr = put(c=2, r=2, I=94) + self.ae(code, 'ENOENT') def test_image_put(self): cw, ch = 10, 20