From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id 1D3523858D28; Thu, 2 Dec 2021 08:45:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D3523858D28 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: console: Fix OSC sequence handling. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: 8fa73a9f8414a4926365324c2fe32a237c2eb91d X-Git-Newrev: e1026837dd43577273ec9fcbaf4c2c41fdabd56d Message-Id: <20211202084512.1D3523858D28@sourceware.org> Date: Thu, 2 Dec 2021 08:45:12 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Dec 2021 08:45:12 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e1026837dd43577273ec9fcbaf4c2c41fdabd56d commit e1026837dd43577273ec9fcbaf4c2c41fdabd56d Author: Takashi Yano Date: Thu Dec 2 12:35:47 2021 +0900 Cygwin: console: Fix OSC sequence handling. - Currently, some OSC escape sequences, such as 'OSC 110 BEL', are not handled correctly. This patch fixes the issue. Diff: --- winsup/cygwin/fhandler_console.cc | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index d9ed71af8..4c98b5355 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -3308,13 +3308,30 @@ fhandler_console::write (const void *vsrc, size_t len) case gotrsquare: if (isdigit (*src)) con.rarg = con.rarg * 10 + (*src - '0'); - else if (*src == ';' && (con.rarg == 2 || con.rarg == 0)) - con.state = gettitle; - else if (*src == ';' && (con.rarg == 4 || con.rarg == 104 - || (con.rarg >= 10 && con.rarg <= 19))) - con.state = eatpalette; - else - con.state = eattitle; + else if (*src == ';') + { + if (con.rarg == 0 || con.rarg == 2) + con.state = gettitle; + else if ((con.rarg >= 4 && con.rarg <= 6) + || (con.rarg >=10 && con.rarg <= 19) + || (con.rarg >=104 && con.rarg <= 106) + || (con.rarg >=110 && con.rarg <= 119)) + con.state = eatpalette; + else + con.state = eattitle; + } + else if (*src == '\033') + con.state = endpalette; + else if (*src == '\007') + { + wpbuf.put (*src); + if (wincap.has_con_24bit_colors () && !con_is_legacy) + wpbuf.send (get_output_handle ()); + wpbuf.empty (); + con.state = normal; + src++; + break; + } wpbuf.put (*src); src++; break;