public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Console doesn't work correctly under anything else than cmd or mintty
@ 2020-05-12 20:26 Kacper Michajlow
  2020-05-13  8:50 ` Eric Lilja
  2020-05-13 10:34 ` Takashi Yano
  0 siblings, 2 replies; 12+ messages in thread
From: Kacper Michajlow @ 2020-05-12 20:26 UTC (permalink / raw)
  To: cygwin

Hi,

I was testing latest master (e637d53) and console is clunky in anything
that isn't cmd.exe or mintty. I tested Microsoft Terminal and ConEmu.

For example navigating with arrows doesn't work in vim. In zsh searching
history with up arrow when there is beginning of the command doesn't work.
And so on, sometimes Home button doesn't work to jump to beginning of the
line or Backspace to clear input.

It used to work better. I have tried CYGWIN=disable_pcon but didn't help
really.

Is it known problem? Is there a workaround? Should this be fixed in Cygwin
or somewhere else?

Thanks,
Kacper

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

* Re: Console doesn't work correctly under anything else than cmd or mintty
  2020-05-12 20:26 Console doesn't work correctly under anything else than cmd or mintty Kacper Michajlow
@ 2020-05-13  8:50 ` Eric Lilja
  2020-05-13 10:34 ` Takashi Yano
  1 sibling, 0 replies; 12+ messages in thread
From: Eric Lilja @ 2020-05-13  8:50 UTC (permalink / raw)
  To: cygwin

I had a similar experience when I tried to use the CLI that comes with
MongoDB. Switched to use TakeCommand instead when I needed to use the
MongoDB CLI. Too bad!

- Eric L

On Tue, May 12, 2020 at 11:05 PM Kacper Michajlow via Cygwin <
cygwin@cygwin.com> wrote:

> Hi,
>
> I was testing latest master (e637d53) and console is clunky in anything
> that isn't cmd.exe or mintty. I tested Microsoft Terminal and ConEmu.
>
> For example navigating with arrows doesn't work in vim. In zsh searching
> history with up arrow when there is beginning of the command doesn't work.
> And so on, sometimes Home button doesn't work to jump to beginning of the
> line or Backspace to clear input.
>
> It used to work better. I have tried CYGWIN=disable_pcon but didn't help
> really.
>
> Is it known problem? Is there a workaround? Should this be fixed in Cygwin
> or somewhere else?
>
> Thanks,
> Kacper
> --
> Problem reports:      https://cygwin.com/problems.html
> FAQ:                  https://cygwin.com/faq/
> Documentation:        https://cygwin.com/docs.html
> Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
>

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

* Re: Console doesn't work correctly under anything else than cmd or mintty
  2020-05-12 20:26 Console doesn't work correctly under anything else than cmd or mintty Kacper Michajlow
  2020-05-13  8:50 ` Eric Lilja
@ 2020-05-13 10:34 ` Takashi Yano
       [not found]   ` <CABPLASQf4L0WN6wOFd2C6=6ZY1hM9mCL6LaNLsQRa4yGbP6=Mw@mail.gmail.com>
  1 sibling, 1 reply; 12+ messages in thread
From: Takashi Yano @ 2020-05-13 10:34 UTC (permalink / raw)
  To: cygwin

On Tue, 12 May 2020 22:26:07 +0200
Kacper Michajlow via Cygwin <cygwin@cygwin.com> wrote:
> I was testing latest master (e637d53) and console is clunky in anything
> that isn't cmd.exe or mintty. I tested Microsoft Terminal and ConEmu.
> 
> For example navigating with arrows doesn't work in vim. In zsh searching
> history with up arrow when there is beginning of the command doesn't work.
> And so on, sometimes Home button doesn't work to jump to beginning of the
> line or Backspace to clear input.

As for ConEmu, please use cygwin-connector.
https://conemu.github.io/en/CygwinMsysConnector.html

What do you mean by "Microsoft Terminal"? Also, do you use cygwin vim?
If you mean "Windows Terminal" and cygwin vim, I cannot reproduce your
problem. Arrow keys are working correctly in vim with Windows Terminal
as well as with console (command prompt).

> It used to work better. I have tried CYGWIN=disable_pcon but didn't help
> really.

disable_pcon does not affect cygwin console behaviour. It is for pty.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

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

* Re: Console doesn't work correctly under anything else than cmd or mintty
       [not found]   ` <CABPLASQf4L0WN6wOFd2C6=6ZY1hM9mCL6LaNLsQRa4yGbP6=Mw@mail.gmail.com>
@ 2020-05-14  3:33     ` Takashi Yano
  2020-05-14 17:48       ` Kacper Michajlow
  0 siblings, 1 reply; 12+ messages in thread
From: Takashi Yano @ 2020-05-14  3:33 UTC (permalink / raw)
  To: cygwin

On Thu, 14 May 2020 01:15:55 +0200
Kacper Michajlow <kasper93@gmail.com> wrote:

> On Wed, 13 May 2020 at 12:34, Takashi Yano <takashi.yano@nifty.ne.jp> wrote:
> 
> > What do you mean by "Microsoft Terminal"? Also, do you use cygwin vim?
> > If you mean "Windows Terminal" and cygwin vim, I cannot reproduce your
> > problem. Arrow keys are working correctly in vim with Windows Terminal
> > as well as with console (command prompt)
> 
> 
> Of course, I meant Windows Terminal, silly mistake :)
> 
> Also I am sorry for not checking it thoroughly enough. Because while it
> broke by updating Cygwin, actually updating WT to latest version fixed most
> of my problems. I have not tested it much yet, but only one issue remains.
> 
> When something ask for user input, Backspace doesn't work in remote ssh
> session.
> 
> STR:
> 1. ssh <hostname>
> 2. Run read command
> 3. You can type, but trying to erase char with Backspace key will print ⌂
> instead.
> 
> This happens only in remote ssh session in WT using Cygwin's ssh. Works
> fine using Native Window's OpenSSH client or in local Cygwin session. Also
> works fine when using mintty or WSL for that matter...
> 
> I don't know who is to blame here, WT or Cygwin?

I guess setting
stty erase '^?'
on the host <hostname> resolves this problem.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

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

* Re: Console doesn't work correctly under anything else than cmd or mintty
  2020-05-14  3:33     ` Takashi Yano
@ 2020-05-14 17:48       ` Kacper Michajlow
  2020-05-14 23:47         ` Takashi Yano
  0 siblings, 1 reply; 12+ messages in thread
From: Kacper Michajlow @ 2020-05-14 17:48 UTC (permalink / raw)
  To: Takashi Yano; +Cc: cygwin

On Thu, 14 May 2020 at 05:33, Takashi Yano <takashi.yano@nifty.ne.jp> wrote:

> I guess setting
> stty erase '^?'
> on the host <hostname> resolves this problem.
>

Nope, it still doesn't work. And '^?' default so it doesn't change
anything. Please note that in bash Backspace works fine, but in read
command (or any other program that ask input from stdin) it fails.

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

* Re: Console doesn't work correctly under anything else than cmd or mintty
  2020-05-14 17:48       ` Kacper Michajlow
@ 2020-05-14 23:47         ` Takashi Yano
  2020-05-15  9:34           ` Kacper Michajlow
  2020-05-15 20:57           ` Brian Inglis
  0 siblings, 2 replies; 12+ messages in thread
From: Takashi Yano @ 2020-05-14 23:47 UTC (permalink / raw)
  To: cygwin

On Thu, 14 May 2020 19:48:59 +0200
Kacper Michajlow wrote:
> On Thu, 14 May 2020 at 05:33, Takashi Yano <takashi.yano@nifty.ne.jp> wrote:
> 
> > I guess setting
> > stty erase '^?'
> > on the host <hostname> resolves this problem.
> >
> 
> Nope, it still doesn't work. And '^?' default so it doesn't change
> anything. Please note that in bash Backspace works fine, but in read
> command (or any other program that ask input from stdin) it fails.

Please check the result of
xxd
Ctrl-V Backspace Enter Ctrl-D

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

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

* Re: Console doesn't work correctly under anything else than cmd or mintty
  2020-05-14 23:47         ` Takashi Yano
@ 2020-05-15  9:34           ` Kacper Michajlow
  2020-05-15 11:45             ` Takashi Yano
  2020-05-15 20:57           ` Brian Inglis
  1 sibling, 1 reply; 12+ messages in thread
From: Kacper Michajlow @ 2020-05-15  9:34 UTC (permalink / raw)
  To: Takashi Yano; +Cc: cygwin

On Fri, 15 May 2020 at 01:47, Takashi Yano <takashi.yano@nifty.ne.jp> wrote:

> Please check the result of
> xxd
> Ctrl-V Backspace Enter Ctrl-D
>


Here is comparison with running ssh connection to the same machine in WT
and Mintty. Also I noticed that selecting and copying multi-line output of
stty in Windows Terminal was missing new line and was filled with spaces to
the end on terminal window.

Windows Terminal:

$ echo $TERM
xterm-256color
$ stty
speed 38400 baud; line = 0;
eol = M-^?; eol2 = M-^?;
-brkint -imaxbel iutf8
-echoe -echok -echoctl -echoke
$ xxd
⌂
00000000: 7f0a                                     ..
$ stty -a
speed 38400 baud; rows 38; columns 139; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 =
M-^?; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon
-ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0
ff0
isig icanon iexten echo -echoe -echok -echonl -noflsh -xcase -tostop
-echoprt -echoctl -echoke -flusho -extproc

Mintty:

$ echo $TERM
xterm-256color
$ stty
speed 38400 baud; line = 0;
eol = M-^?; eol2 = M-^?;
-brkint ixany iutf8
$ xxd
^?
00000000: 7f0a                                     ..
$ stty -a
speed 38400 baud; rows 41; columns 135; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 =
M-^?; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon
-ixoff -iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0
ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke -flusho -extproc

--
In local session, both Mintty and WT in xxd test produce:
00000000: 0a

- Kacper

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

* Re: Console doesn't work correctly under anything else than cmd or mintty
  2020-05-15  9:34           ` Kacper Michajlow
@ 2020-05-15 11:45             ` Takashi Yano
  2020-05-15 15:41               ` Kacper Michajlow
  0 siblings, 1 reply; 12+ messages in thread
From: Takashi Yano @ 2020-05-15 11:45 UTC (permalink / raw)
  To: cygwin

On Fri, 15 May 2020 11:34:33 +0200
Kacper Michajlow wrote:
> Windows Terminal:
> 
> $ echo $TERM
> xterm-256color
> $ stty
> speed 38400 baud; line = 0;
> eol = M-^?; eol2 = M-^?;
> -brkint -imaxbel iutf8
> -echoe -echok -echoctl -echoke
...
> Mintty:
> 
> $ echo $TERM
> xterm-256color
> $ stty
> speed 38400 baud; line = 0;
> eol = M-^?; eol2 = M-^?;
> -brkint ixany iutf8

Then,
stty echoe echok echoctl echoke
should solve the problem.

This causes because cygwin does not set ECHOE, ECHOK, ECHOCTL and ECHOKE
by default. Mintty sets them by itself. Tcsh seems also to set them.
However, bash does not.

Could someone please tell me whether cygwin should set them by default?

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

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

* Re: Console doesn't work correctly under anything else than cmd or mintty
  2020-05-15 11:45             ` Takashi Yano
@ 2020-05-15 15:41               ` Kacper Michajlow
  0 siblings, 0 replies; 12+ messages in thread
From: Kacper Michajlow @ 2020-05-15 15:41 UTC (permalink / raw)
  To: Takashi Yano; +Cc: cygwin

On Fri, 15 May 2020 at 13:45, Takashi Yano <takashi.yano@nifty.ne.jp> wrote:

> ...
> Then,
> stty echoe echok echoctl echoke
> should solve the problem.
>

Indeed, but I got confused, because it does work fine in local session and
it also has -echoe -echok -echoctl -echoke... What is the difference? I'm
just curious at this point.


> This causes because cygwin does not set ECHOE, ECHOK, ECHOCTL and ECHOKE
> by default. Mintty sets them by itself. Tcsh seems also to set them.
> However, bash does not.
>

FWIW, zsh also does not set those.

Thanks for help and patience :)

- Kacper

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

* Re: Console doesn't work correctly under anything else than cmd or mintty
  2020-05-14 23:47         ` Takashi Yano
  2020-05-15  9:34           ` Kacper Michajlow
@ 2020-05-15 20:57           ` Brian Inglis
  2020-05-16  4:58             ` Takashi Yano
  1 sibling, 1 reply; 12+ messages in thread
From: Brian Inglis @ 2020-05-15 20:57 UTC (permalink / raw)
  To: cygwin

On 2020-05-14 17:47, Takashi Yano via Cygwin wrote:
> On Thu, 14 May 2020 19:48:59 +0200
> Kacper Michajlow wrote:
>> On Thu, 14 May 2020 at 05:33, Takashi Yano <takashi.yano@nifty.ne.jp> wrote:
>>
>>> I guess setting
>>> stty erase '^?'
>>> on the host <hostname> resolves this problem.
>>>
>>
>> Nope, it still doesn't work. And '^?' default so it doesn't change
>> anything. Please note that in bash Backspace works fine, but in read
>> command (or any other program that ask input from stdin) it fails.
> 
> Please check the result of
> xxd
> Ctrl-V Backspace Enter Ctrl-D

As xxd is an optional package, and od is in base coreutils package, you may want
to suggest e.g.

	$ od -atx1
	<Ctrl-V><Backspace><Enter><Ctrl-D> [four key entries]

and please post the output.

Alternatively cygcheck -k is intended for testing console key codes under cmd,
and if that could be helpful, ask for cmd to be run, then in that console
session, type:

	> cygcheck -k
	<Backspace>q [two key entries]

and please post the output e.g.

>cygcheck -k

This key check works only in a console window, _NOT_ in a terminal session!
Abort with Ctrl+C if in a terminal session.

Press 'q' to exit.
Released 1x VK: 0x0008 VS: 0x000e C: 0x0008 CTRL: -- -- -- -- NL -- -- -- --
Pressed  1x VK: 0x0051 VS: 0x0010 C: 0x0071 CTRL: -- -- -- -- NL -- -- -- --
Released 1x VK: 0x0051 VS: 0x0010 C: 0x0071 CTRL: -- -- -- -- NL -- -- -- --

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in IEC units and prefixes, physical quantities in SI.]

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

* Re: Console doesn't work correctly under anything else than cmd or mintty
  2020-05-15 20:57           ` Brian Inglis
@ 2020-05-16  4:58             ` Takashi Yano
  2020-05-16 12:10               ` Brian Inglis
  0 siblings, 1 reply; 12+ messages in thread
From: Takashi Yano @ 2020-05-16  4:58 UTC (permalink / raw)
  To: cygwin

On Fri, 15 May 2020 14:57:14 -0600
Brian Inglis wrote:
> >cygcheck -k
> 
> This key check works only in a console window, _NOT_ in a terminal session!
> Abort with Ctrl+C if in a terminal session.

Now cygcheck -k works in pty in a limited way due to pseudo
console support if the OS is Win10 1809 or later.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

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

* Re: Console doesn't work correctly under anything else than cmd or mintty
  2020-05-16  4:58             ` Takashi Yano
@ 2020-05-16 12:10               ` Brian Inglis
  0 siblings, 0 replies; 12+ messages in thread
From: Brian Inglis @ 2020-05-16 12:10 UTC (permalink / raw)
  To: cygwin

On 2020-05-15 22:58, Takashi Yano via Cygwin wrote:
> On Fri, 15 May 2020 14:57:14 -0600
> Brian Inglis wrote:
>>> cygcheck -k
>>
>> This key check works only in a console window, _NOT_ in a terminal session!
>> Abort with Ctrl+C if in a terminal session.
> 
> Now cygcheck -k works in pty in a limited way due to pseudo
> console support if the OS is Win10 1809 or later.

But the results are not comparable: under mintty <Backspace>q gives:

$ cygcheck -k

This key check works only in a console window, _NOT_ in a terminal session!
Abort with Ctrl+C if in a terminal session.

Press 'q' to exit.
Pressed  1x VK: 0x0048 VS: 0x0023 C: 0x0008 CTRL: -- -- -- LC -- -- -- -- --
Released 1x VK: 0x0048 VS: 0x0023 C: 0x0008 CTRL: -- -- -- LC -- -- -- -- --
Released 1x VK: 0x0011 VS: 0x001d C: 0x0000 CTRL: -- -- -- -- -- -- -- -- --
Pressed  1x VK: 0x0051 VS: 0x003c C: 0x0071 CTRL: -- -- -- -- -- -- -- -- --
Released 1x VK: 0x0051 VS: 0x003c C: 0x0071 CTRL: -- -- -- -- -- -- -- -- --

whereas under cmd we see:

 > cygcheck -k

This key check works only in a console window, _NOT_ in a terminal session!
Abort with Ctrl+C if in a terminal session.

Press 'q' to exit.
Released 1x VK: 0x0008 VS: 0x000e C: 0x0008 CTRL: -- -- -- -- NL -- -- -- --
Pressed  1x VK: 0x0051 VS: 0x0010 C: 0x0071 CTRL: -- -- -- -- NL -- -- -- --
Released 1x VK: 0x0051 VS: 0x0010 C: 0x0071 CTRL: -- -- -- -- NL -- -- -- --

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in IEC units and prefixes, physical quantities in SI.]

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

end of thread, other threads:[~2020-05-16 12:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 20:26 Console doesn't work correctly under anything else than cmd or mintty Kacper Michajlow
2020-05-13  8:50 ` Eric Lilja
2020-05-13 10:34 ` Takashi Yano
     [not found]   ` <CABPLASQf4L0WN6wOFd2C6=6ZY1hM9mCL6LaNLsQRa4yGbP6=Mw@mail.gmail.com>
2020-05-14  3:33     ` Takashi Yano
2020-05-14 17:48       ` Kacper Michajlow
2020-05-14 23:47         ` Takashi Yano
2020-05-15  9:34           ` Kacper Michajlow
2020-05-15 11:45             ` Takashi Yano
2020-05-15 15:41               ` Kacper Michajlow
2020-05-15 20:57           ` Brian Inglis
2020-05-16  4:58             ` Takashi Yano
2020-05-16 12:10               ` Brian Inglis

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).