From 7472e9c1524442e1a91f57b981229159f4bc6fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 19 Jul 2019 09:57:51 +0200 Subject: [PATCH] csi: recognize DECRQM (CSI ? Ps $ p) The client sends this to request the state of DEC private modes. We don't support any of them, so for now, reply with 'reset'. --- csi.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/csi.c b/csi.c index 666a8ba5..7709dfd6 100644 --- a/csi.c +++ b/csi.c @@ -822,6 +822,29 @@ csi_dispatch(struct terminal *term, uint8_t final) break; } + case 'p': { + if (term->vt.private[1] != '$') { + LOG_ERR("unimplemented: %s", csi_as_string(term, final)); + abort(); + } + + unsigned param = vt_param_get(term, 0, 0); + + /* + * Request DEC private mode (DECRQM) + * Reply: + * 0 - not recognized + * 1 - set + * 2 - reset + * 3 - permanently set + * 4 - permantently reset + */ + char reply[32]; + snprintf(reply, sizeof(reply), "\033[?%u;2$y", param); + vt_to_slave(term, reply, strlen(reply)); + break; + } + case 's': for (size_t i = 0; i < term->vt.params.idx; i++) { switch (term->vt.params.v[i].value) {