From: nicm Date: Mon, 9 Jan 2023 07:57:14 +0000 (+0000) Subject: Accept \007 as terminator to OSC 10 or 11. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ce2a788356c69a4fb5ae6015b5ffa2bf619aad5e;p=openbsd Accept \007 as terminator to OSC 10 or 11. --- diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c index d0a423daf3c..bce7632d77e 100644 --- a/usr.bin/tmux/tty-keys.c +++ b/usr.bin/tmux/tty-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-keys.c,v 1.163 2023/01/03 11:43:24 nicm Exp $ */ +/* $OpenBSD: tty-keys.c,v 1.164 2023/01/09 07:57:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1516,18 +1516,25 @@ tty_keys_colours(struct tty *tty, const char *buf, size_t len, size_t *size) if (len == 5) return (1); - /* Copy the rest up to \033\. */ + /* Copy the rest up to \033\ or \007. */ for (i = 0; i < (sizeof tmp) - 1; i++) { if (5 + i == len) return (1); if (buf[5 + i - 1] == '\033' && buf[5 + i] == '\\') break; + if (buf[5 + i] == '\007') + break; tmp[i] = buf[5 + i]; } if (i == (sizeof tmp) - 1) return (-1); - tmp[i - 1] = '\0'; - *size = 6 + i; + if (tmp[i] == '\007') { + *size = 5 + i; + tmp[i] = '\0'; + } else { + *size = 6 + i; + tmp[i - 1] = '\0'; + } n = colour_parseX11(tmp); if (n != -1 && buf[3] == '0') {