aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2021-12-02 12:35:47 +0900
committerTakashi Yano <takashi.yano@nifty.ne.jp>2021-12-02 11:26:26 +0900
commite1026837dd43577273ec9fcbaf4c2c41fdabd56d (patch)
tree8ab761ecef9303544b153f7c152df0c15e1623c4
parent8fa73a9f8414a4926365324c2fe32a237c2eb91d (diff)
downloadnewlib-e1026837dd43577273ec9fcbaf4c2c41fdabd56d.zip
newlib-e1026837dd43577273ec9fcbaf4c2c41fdabd56d.tar.gz
newlib-e1026837dd43577273ec9fcbaf4c2c41fdabd56d.tar.bz2
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.
-rw-r--r--winsup/cygwin/fhandler_console.cc31
1 files changed, 24 insertions, 7 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index d9ed71a..4c98b53 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;