Cygwin: Add IUTF8 termios iflag

The termios code doesn't handle erasing of multibyte characters
in canonical mode, it always erases a single byte.  When entering
a multibyte character and then pressing VERASE, the input ends up
with an invalid character.

Following Linux we introduce the IUTF8 input flag now, set by
default.  When this flag is set, VERASE or VWERASE will check
if the just erased input byte is a UTF-8 continuation byte.  If
so, it erases another byte and checks again until the entire
UTF-8 character has been removed from the input buffer.

Note that this (just as on Linux) does NOT work with arbitrary
multibyte codesets.  This only works with UTF-8.

For a discussion what happens, see
https://cygwin.com/ml/cygwin/2017-01/msg00299.html

Sidenote: The eat_readahead function is now member of fhandler_termios,
not fhandler_base.  That's necessary to get access to the terminal's
termios flags.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2017-01-31 15:36:24 +01:00
parent cd5e7e2d82
commit 095cac4b8d
4 changed files with 31 additions and 23 deletions

View File

@ -115,6 +115,7 @@ POSIX commands */
#define IUCLC 0x04000
#define IXANY 0x08000
#define PARMRK 0x10000
#define IUTF8 0x20000
/* oflag bits */