* [PATCH 0/2] Two pty fixes regarding pseudo console.
@ 2020-11-23 5:28 Takashi Yano
2020-11-23 5:28 ` [PATCH 1/2] Cygwin: pty: Fix a bug in the code removing "CSI > Pm m" Takashi Yano
2020-11-23 5:28 ` [PATCH 2/2] Cygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output Takashi Yano
0 siblings, 2 replies; 5+ messages in thread
From: Takashi Yano @ 2020-11-23 5:28 UTC (permalink / raw)
To: cygwin-patches
Takashi Yano (2):
Cygwin: pty: Fix a bug in the code removing "CSI > Pm m".
Cygwin: pty: Discard "OSC Ps;? BEL/ST" in pseudo console output.
winsup/cygwin/fhandler_tty.cc | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
--
2.29.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] Cygwin: pty: Fix a bug in the code removing "CSI > Pm m".
2020-11-23 5:28 [PATCH 0/2] Two pty fixes regarding pseudo console Takashi Yano
@ 2020-11-23 5:28 ` Takashi Yano
2020-11-23 5:28 ` [PATCH 2/2] Cygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output Takashi Yano
1 sibling, 0 replies; 5+ messages in thread
From: Takashi Yano @ 2020-11-23 5:28 UTC (permalink / raw)
To: cygwin-patches
- The code added by 8121b606e843c001d5ca5213d24099e04ebc62ca has a
bug which fails to remove multiple "CSI > Pm m" sequences. This
patch fixes the bug.
---
winsup/cygwin/fhandler_tty.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 600de085c..911945675 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -2063,6 +2063,7 @@ fhandler_pty_master::pty_master_fwd_thread ()
memmove (&outbuf[start_at], &outbuf[i+1], rlen-i-1);
rlen = wlen = start_at + rlen - i - 1;
state = 0;
+ i = start_at - 1;
continue;
}
else
--
2.29.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] Cygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output.
2020-11-23 5:28 [PATCH 0/2] Two pty fixes regarding pseudo console Takashi Yano
2020-11-23 5:28 ` [PATCH 1/2] Cygwin: pty: Fix a bug in the code removing "CSI > Pm m" Takashi Yano
@ 2020-11-23 5:28 ` Takashi Yano
2020-11-23 8:58 ` Corinna Vinschen
1 sibling, 1 reply; 5+ messages in thread
From: Takashi Yano @ 2020-11-23 5:28 UTC (permalink / raw)
To: cygwin-patches
- If vim is executed in WSL in mintty, some garbage string caused
by "OSC Ps;? BEL/ST" will be shown in some situations. This patch
fixes the issue by removing "OSC Ps;? BEL/ST" from pseudo console
output.
---
winsup/cygwin/fhandler_tty.cc | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 911945675..38285c7f4 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -2069,6 +2069,36 @@ fhandler_pty_master::pty_master_fwd_thread ()
else
state = 0;
+ /* Remove OSC Ps ; ? BEL/ST */
+ for (DWORD i=0; i<rlen; i++)
+ if (state == 0 && outbuf[i] == '\033')
+ {
+ start_at = i;
+ state = 1;
+ continue;
+ }
+ else if ((state == 1 && outbuf[i] == ']')
+ || (state == 2 && outbuf[i] == ';')
+ || (state == 3 && outbuf[i] == '?')
+ || (state == 4 && outbuf[i] == '\033'))
+ {
+ state ++;
+ continue;
+ }
+ else if (state == 2 && isdigit (outbuf[i]))
+ continue;
+ else if ((state == 4 && outbuf[i] == '\a')
+ || (state == 5 && outbuf[i] == '\\'))
+ {
+ memmove (&outbuf[start_at], &outbuf[i+1], rlen-i-1);
+ rlen = wlen = start_at + rlen - i - 1;
+ state = 0;
+ i = start_at - 1;
+ continue;
+ }
+ else
+ state = 0;
+
if (get_ttyp ()->term_code_page != CP_UTF8)
{
size_t nlen = NT_MAX_PATH;
--
2.29.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Cygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output.
2020-11-23 5:28 ` [PATCH 2/2] Cygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output Takashi Yano
@ 2020-11-23 8:58 ` Corinna Vinschen
2020-11-23 11:02 ` Takashi Yano
0 siblings, 1 reply; 5+ messages in thread
From: Corinna Vinschen @ 2020-11-23 8:58 UTC (permalink / raw)
To: cygwin-patches
Hi Takashi,
just a small style nit:
On Nov 23 14:28, Takashi Yano via Cygwin-patches wrote:
> - If vim is executed in WSL in mintty, some garbage string caused
> by "OSC Ps;? BEL/ST" will be shown in some situations. This patch
> fixes the issue by removing "OSC Ps;? BEL/ST" from pseudo console
> output.
> ---
> winsup/cygwin/fhandler_tty.cc | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
> index 911945675..38285c7f4 100644
> --- a/winsup/cygwin/fhandler_tty.cc
> +++ b/winsup/cygwin/fhandler_tty.cc
> @@ -2069,6 +2069,36 @@ fhandler_pty_master::pty_master_fwd_thread ()
> else
> state = 0;
>
> + /* Remove OSC Ps ; ? BEL/ST */
> + for (DWORD i=0; i<rlen; i++)
^^^ ^^^^^^
spaces
Thanks,
Corinna
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Cygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output.
2020-11-23 8:58 ` Corinna Vinschen
@ 2020-11-23 11:02 ` Takashi Yano
0 siblings, 0 replies; 5+ messages in thread
From: Takashi Yano @ 2020-11-23 11:02 UTC (permalink / raw)
To: cygwin-patches
On Mon, 23 Nov 2020 09:58:59 +0100
Corinna Vinschen wrote:
> Hi Takashi,
>
> just a small style nit:
>
> On Nov 23 14:28, Takashi Yano via Cygwin-patches wrote:
> > - If vim is executed in WSL in mintty, some garbage string caused
> > by "OSC Ps;? BEL/ST" will be shown in some situations. This patch
> > fixes the issue by removing "OSC Ps;? BEL/ST" from pseudo console
> > output.
> > ---
> > winsup/cygwin/fhandler_tty.cc | 30 ++++++++++++++++++++++++++++++
> > 1 file changed, 30 insertions(+)
> >
> > diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
> > index 911945675..38285c7f4 100644
> > --- a/winsup/cygwin/fhandler_tty.cc
> > +++ b/winsup/cygwin/fhandler_tty.cc
> > @@ -2069,6 +2069,36 @@ fhandler_pty_master::pty_master_fwd_thread ()
> > else
> > state = 0;
> >
> > + /* Remove OSC Ps ; ? BEL/ST */
> > + for (DWORD i=0; i<rlen; i++)
> ^^^ ^^^^^^
> spaces
I will submit v2 patch. Thanks.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-11-23 11:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-23 5:28 [PATCH 0/2] Two pty fixes regarding pseudo console Takashi Yano
2020-11-23 5:28 ` [PATCH 1/2] Cygwin: pty: Fix a bug in the code removing "CSI > Pm m" Takashi Yano
2020-11-23 5:28 ` [PATCH 2/2] Cygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output Takashi Yano
2020-11-23 8:58 ` Corinna Vinschen
2020-11-23 11:02 ` Takashi Yano
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).