On Thu, 20 Feb 2020 14:44:59 +0100
Corinna Vinschen wrote:
On Feb 20 14:35, Corinna Vinschen wrote:
On Feb 20 20:51, Takashi Yano wrote:
- 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(+)
[...]
Counter-proposal:
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 66e645aa1774..1b3aa0f34aa6 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
[...]
Btw., I tested this with
write (1, "A\0B\0C\0D", 7);
it turned out that this results in broken output even with your patch.
The reason is that a NUL byte must not (cannot) be evaluated by
dev_console::str_to_con() -> sys_cp_mbstowcs(). The latter doesn't
handle embedded NUL bytes gracefully.
Indeed. Your patch is much better.
On Thu, 20 Feb 2020 14:35:31 +0100
Corinna Vinschen wrote:
But, here's a question: Why do we move the cursor to the right at all?
I assume this is compatible with legacy mode, right?
Hmm. This may be a bug of legacy console.
https://en.wikipedia.org/wiki/Null_character
says
(some terminals, however, incorrectly display it as space)
What about ignoring NUL in legacy mode too?