Cygwin: pty, termios: Unify thoughts of read ahead beffer handling.
- Return value of eat_readahead() is redefined. The return values of fhandler_termios::eat_readahead() and fhandler_pty_slave:: eat_readahead() were little bit different. This patch unifies them to number of bytes eaten by eat_readahead(). - Considerration for raixget() is added to fhandler_pty_master:: accept_input() code. - Transfering contents of read ahead buffer in fhandler_pty_master::transfer_input_to_pcon() is removed since it is not necessary. - fhandler_pty_slave::eat_readahead() ckecks EOL only when ICANON is set. - Guard for _POSIX_VDISABLE is added in checking EOL.
This commit is contained in:
committed by
Corinna Vinschen
parent
8121b606e8
commit
c11b0343c0
@ -268,25 +268,25 @@ fhandler_termios::eat_readahead (int n)
|
||||
{
|
||||
int oralen = ralen ();
|
||||
if (n < 0)
|
||||
n = ralen ();
|
||||
if (n > 0 && ralen () > 0)
|
||||
n = ralen () - raixget ();
|
||||
if (n > 0 && ralen () > raixget ())
|
||||
{
|
||||
if ((int) (ralen () -= n) < 0)
|
||||
ralen () = 0;
|
||||
if ((int) (ralen () -= n) < (int) raixget ())
|
||||
ralen () = raixget ();
|
||||
/* If IUTF8 is set, the terminal is in UTF-8 mode. If so, we erase
|
||||
a complete UTF-8 multibyte sequence on VERASE/VWERASE. Otherwise,
|
||||
if we only erase a single byte, invalid unicode chars are left in
|
||||
the input. */
|
||||
if (tc ()->ti.c_iflag & IUTF8)
|
||||
while (ralen () > 0 &&
|
||||
while (ralen () > raixget () &&
|
||||
((unsigned char) rabuf ()[ralen ()] & 0xc0) == 0x80)
|
||||
--ralen ();
|
||||
|
||||
if (raixget () >= ralen ())
|
||||
raixget () = raixput () = ralen () = 0;
|
||||
else if (raixput () > ralen ())
|
||||
raixput () = ralen ();
|
||||
}
|
||||
oralen = oralen - ralen ();
|
||||
if (raixget () >= ralen ())
|
||||
raixget () = raixput () = ralen () = 0;
|
||||
else if (raixput () > ralen ())
|
||||
raixput () = ralen ();
|
||||
|
||||
return oralen;
|
||||
}
|
||||
|
Reference in New Issue
Block a user