Re: Escape sequences unprocessed under the "cygwin" terminal

2016-10-12 Thread Thomas Wolff
The interpretation of terminal escape sequences in the Windows console 
is done by the Cygwin DLL.

That explains all your observations.
Thomas

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: Escape sequences unprocessed under the "cygwin" terminal

2016-10-12 Thread Andrey ``Bass'' Shcheglov
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Marco,

Thank you for your response.

On 12.10.2016 13:32, Marco Atzeri wrote:
> On 12/10/2016 10:36, Andrey ``Bass'' Shcheglov wrote:
>>
>> It works fine under regular Unices, and also under xterm and mintty
>> (in Cygwin), but I'm having trouble running it under the "cygwin"
>> terminal (i. e. bash launched from cmd.exe).
> 
> cmd is not a Cygwin terminal, it is a limited Windows one.
> What is the problem to use mintty ?

There's no problem. I'm just trying to understand the limitations of
cmd.exe (TERM=cygwin). FWIK, bash.exe *can* properly translate ANSI
escape sequences into WinAPI calls. Strangely, the same C program:

> #include 
> 
> int main() {
>   const char esc = 0x1b;
>   printf("%c[31;91;1mHello, World!%c[0m\n", esc, esc);
>   return 0;
> }

behaves correctly with TERM=cygwin when compiled with Cygwin GCC and
linked against cygwin1.dll:

> $ ldd test-ansi-escape.exe
>   ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x7ffeeb45)
>   KERNEL32.DLL => /cygdrive/c/Windows/system32/KERNEL32.DLL (0x7ffee92c
)
>   KERNELBASE.dll => /cygdrive/c/Windows/system32/KERNELBASE.dll (0x7ffe
e870)
>   cygwin1.dll => /usr/bin/cygwin1.dll (0x18004)

and displays garbage like

> ←[31;91;1mHello, World!←[0m

when compiled with MSVC as a native Windows application:

> $ ldd test-ansi-escape.exe
>   ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x7ffeeb45)
>   ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x770a)
>   wow64.dll => /cygdrive/c/Windows/SYSTEM32/wow64.dll (0x76fd)
>   wow64win.dll => /cygdrive/c/Windows/system32/wow64win.dll (0x7702
)
>   wow64cpu.dll => /cygdrive/c/Windows/system32/wow64cpu.dll (0x7709
)
>   ??? => ??? (0x104)
>   KERNEL32.DLL => /cygdrive/c/Windows/SYSTEM32/KERNEL32.DLL (0x7648
)
>   ??? => ??? (0x104)
>   ??? => ??? (0x104)
>   KERNEL32.DLL => /cygdrive/c/Windows/SYSTEM32/KERNEL32.DLL (0x7648
)
>   KERNELBASE.dll => /cygdrive/c/Windows/SYSTEM32/KERNELBASE.dll (0x74b4
)
>   MSVCR120D.dll => /cygdrive/c/Windows/SYSTEM32/MSVCR120D.dll (0x62b900
00)

>> Also, if I log in to my Windows box using SSH (i. e. replace the loca
l
>> connection with the remote one, but retain the same |"cygwin|"
>> terminal), again, escape sequences are processed just fine.
> 
> from Unix ? The terminal on that side is able to properly manage
> escape sequence

No, from Windows. I mean, I'm doing "ssh.exe localhost" (the process
hierarchy being cmd.exe -> bash.exe -> ssh.exe -> bash.exe) -- and
everything is working again!

> use mintty.
> It is the recommended one for cygwin

I understand mintty is superior feature-wise compared to cmd.exe, and
xterm is superior to both mintty and cmd.exe -- just like I said, I'm
trying to understand the limitations of cmd.exe (TERM=cygwin).

Regards,
Andrey.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iEYEARECAAYFAlf+Jb4ACgkQFX2weoTrDGcDjQCeLfk7Nxeg/SGHZEEa2sPuhWli
MrsAn3rGf/9tcTPD1iAFjFMJYHGjR2fC
=cCH2
-END PGP SIGNATURE-

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: Escape sequences unprocessed under the "cygwin" terminal

2016-10-12 Thread Marco Atzeri

On 12/10/2016 10:36, Andrey ``Bass'' Shcheglov wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi All,

I have a Java application which uses ANSI escape sequences to display
colours, position the cursor, etc.

It works fine under regular Unices, and also under |xterm| and |mintty|
(in Cygwin//), but I'm having trouble running it under the "|cygwin"|
terminal (i. e. |bash| launched from |cmd.exe|).


cmd is not a Cygwin terminal, it is a limited Windows one.
What is the problem to use mintty ?


As you can see from the screen shot
(https://i.stack.imgur.com/Ohg41.png), escape sequences are output "as
is", without processing. On the other hand, I can easily run smth like
|echo -e '\033[1;31mTest'| -- and colour text will be just there.

At the same time, if I launch exactly the same application from a
Midnight Commander//  subshell,
escape sequences produced by the application will be interpreted
correctly: https://i.stack.imgur.com/jV7UW.png

Also, if I log in to my Windows box using SSH (i. e. replace the local
connection with the remote one, but retain the same |"cygwin|"
terminal), again, escape sequences are processed just fine.


from Unix ? The terminal on that side is able to properly manage
escape sequence


It looks like when a subshell of some kind is created (|mc| or |ssh|),
the terminal is put into some other mode. But playing with |stty| wasn't
helpful, nor was export'ing |TERM=ansi|.

Could anyone please suggest any solution?


use mintty.
It is the recommended one for cygwin


I'm running


CYGWIN_NT-6.3 UNIT-725 2.5.1(0.297/5/3) 2016-04-21 22:14 x86_64 Cygwin

and Windows 8.1.

Thank you in advance.

Regards,
Andrey.


Regards
Marco


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Escape sequences unprocessed under the "cygwin" terminal

2016-10-12 Thread Andrey ``Bass'' Shcheglov

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
 
Hi All,

I have a Java application which uses ANSI escape sequences to display
colours, position the cursor, etc.

It works fine under regular Unices, and also under |xterm| and |mintty|
(in Cygwin//), but I'm having trouble running it under the "|cygwin"|
terminal (i. e. |bash| launched from |cmd.exe|).

As you can see from the screen shot
(https://i.stack.imgur.com/Ohg41.png), escape sequences are output "as
is", without processing. On the other hand, I can easily run smth like
|echo -e '\033[1;31mTest'| -- and colour text will be just there.

At the same time, if I launch exactly the same application from a
Midnight Commander//  subshell,
escape sequences produced by the application will be interpreted
correctly: https://i.stack.imgur.com/jV7UW.png

Also, if I log in to my Windows box using SSH (i. e. replace the local
connection with the remote one, but retain the same |"cygwin|"
terminal), again, escape sequences are processed just fine.

It looks like when a subshell of some kind is created (|mc| or |ssh|),
the terminal is put into some other mode. But playing with |stty| wasn't
helpful, nor was export'ing |TERM=ansi|.

Could anyone please suggest any solution?

I'm running

> CYGWIN_NT-6.3 UNIT-725 2.5.1(0.297/5/3) 2016-04-21 22:14 x86_64 Cygwin
and Windows 8.1.

Thank you in advance.

Regards,
Andrey.

-BEGIN PGP SIGNATURE-
Version: GnuPG v2
 
iEYEARECAAYFAlf99goACgkQFX2weoTrDGefMgCdHrp7AxG/DHpOVyKR2YDF4+5c
4IgAoObfYU1JCrgZoCIcXyvH43xMm1QH
=Dp9M
-END PGP SIGNATURE-



--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple