JFYI: Both 0x00 (NUL) and 0x7F (DEL) used to be the filler characters, and were ignored by most (hardware) terminals from the very early days.
HTH, Anton > -----Original Message----- > From: [email protected] <[email protected]> On > Behalf Of Takashi Yano > Sent: Thursday, February 20, 2020 6:52 AM > To: [email protected] > Cc: Takashi Yano <[email protected]> > Subject: [PATCH] Cygwin: console: Ignore 0x00 on write(). > > - In xterm compatible mode, 0x00 on write() behaves incompatible > with real xterm. In xterm, 0x00 completely ignored. Therefore, > 0x00 is ignored by console with this patch. > --- > winsup/cygwin/fhandler_console.cc | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/winsup/cygwin/fhandler_console.cc > b/winsup/cygwin/fhandler_console.cc > index 66e645aa1..705ce696e 100644 > --- a/winsup/cygwin/fhandler_console.cc > +++ b/winsup/cygwin/fhandler_console.cc > @@ -1794,6 +1794,16 @@ bool fhandler_console::write_console (PWCHAR buf, > DWORD len, DWORD& done) > len -= 4; > } > } > + /* Workaround for ^@ (0x00) handling in xterm compatible mode. */ > + if (wincap.has_con_24bit_colors () && !con_is_legacy) > + { > + WCHAR *p = buf; > + while ((p = wmemchr (p, L'\0', len - (p - buf)))) > + { > + memmove (p, p+1, (len - (p+1 - buf))*sizeof (WCHAR)); > + len --; > + } > + } > > if (con.iso_2022_G1 > ? con.vt100_graphics_mode_G1 > -- > 2.21.0
