public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Cygwin: pty: Fix a bug in input transfer for GDB.
@ 2021-02-14 18:47 Takashi Yano
  2021-02-15 12:06 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Takashi Yano @ 2021-02-14 18:47 UTC (permalink / raw)
  To: cygwin-patches

- With this patch, not only NL but also CR is treated as a line end
  in the code checking if input transfer is necessary.
---
 winsup/cygwin/fhandler_tty.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index f6eb3ae4d..5afede859 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -1181,7 +1181,7 @@ fhandler_pty_slave::mask_switch_to_pcon_in (bool mask, bool xfer)
   /* In GDB, transfer input based on setpgid() does not work because
      GDB may not set terminal process group properly. Therefore,
      transfer input here if isHybrid is set. */
-  if (get_ttyp ()->switch_to_pcon_in && !!masked != mask && xfer && isHybrid)
+  if (isHybrid && !!masked != mask && xfer)
     {
       if (mask && get_ttyp ()->pcon_input_state_eq (tty::to_nat))
 	{
@@ -1471,7 +1471,8 @@ wait_retry:
 out:
   termios_printf ("%d = read(%p, %lu)", totalread, ptr, len);
   len = (size_t) totalread;
-  mask_switch_to_pcon_in (false, totalread > 0 && ptr0[totalread - 1] == '\n');
+  bool saw_eol = totalread > 0 && strchr ("\r\n", ptr0[totalread -1]);
+  mask_switch_to_pcon_in (false, saw_eol);
 }
 
 int
-- 
2.30.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Cygwin: pty: Fix a bug in input transfer for GDB.
  2021-02-14 18:47 [PATCH] Cygwin: pty: Fix a bug in input transfer for GDB Takashi Yano
@ 2021-02-15 12:06 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2021-02-15 12:06 UTC (permalink / raw)
  To: cygwin-patches

On Feb 15 03:47, Takashi Yano via Cygwin-patches wrote:
> - With this patch, not only NL but also CR is treated as a line end
>   in the code checking if input transfer is necessary.
> ---
>  winsup/cygwin/fhandler_tty.cc | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
> index f6eb3ae4d..5afede859 100644
> --- a/winsup/cygwin/fhandler_tty.cc
> +++ b/winsup/cygwin/fhandler_tty.cc
> @@ -1181,7 +1181,7 @@ fhandler_pty_slave::mask_switch_to_pcon_in (bool mask, bool xfer)
>    /* In GDB, transfer input based on setpgid() does not work because
>       GDB may not set terminal process group properly. Therefore,
>       transfer input here if isHybrid is set. */
> -  if (get_ttyp ()->switch_to_pcon_in && !!masked != mask && xfer && isHybrid)
> +  if (isHybrid && !!masked != mask && xfer)
>      {
>        if (mask && get_ttyp ()->pcon_input_state_eq (tty::to_nat))
>  	{
> @@ -1471,7 +1471,8 @@ wait_retry:
>  out:
>    termios_printf ("%d = read(%p, %lu)", totalread, ptr, len);
>    len = (size_t) totalread;
> -  mask_switch_to_pcon_in (false, totalread > 0 && ptr0[totalread - 1] == '\n');
> +  bool saw_eol = totalread > 0 && strchr ("\r\n", ptr0[totalread -1]);
> +  mask_switch_to_pcon_in (false, saw_eol);
>  }
>  
>  int
> -- 
> 2.30.0

Pushed.


Thanks,
Corinna

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-15 12:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14 18:47 [PATCH] Cygwin: pty: Fix a bug in input transfer for GDB Takashi Yano
2021-02-15 12:06 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).