vt: escape '\E' properly when logging an ESC sequence

This commit is contained in:
Daniel Eklöf 2019-07-10 16:04:25 +02:00
parent 454133033c
commit 48efc50c23
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

2
vt.c
View file

@ -571,7 +571,7 @@ static const char *
esc_as_string(struct terminal *term, uint8_t final) esc_as_string(struct terminal *term, uint8_t final)
{ {
static char msg[1024]; static char msg[1024];
int c = snprintf(msg, sizeof(msg), "\E"); int c = snprintf(msg, sizeof(msg), "\\E");
if (term->vt.private != 0) if (term->vt.private != 0)
c += snprintf(&msg[c], sizeof(msg) - c, "%c", term->vt.private); c += snprintf(&msg[c], sizeof(msg) - c, "%c", term->vt.private);