Am 28.01.2025 um 09:56 schrieb Corinna Vinschen via Cygwin:
On Jan 28 00:50, Thomas Wolff via Cygwin wrote:
Am 27.01.2025 um 12:17 schrieb Takashi Yano via Cygwin:
Hi Thomas,

A few days ago, Corinna asked me to check a problem of TTY.
The problem is as follows.

Reproduce steps:
(1) Open mintty.
(2) Open another mintty.
(3) Place the second mintty window over the first one.
(4) Hold ctrl key down.
(5) Press 'd' key while holding ctrl key. The second mintty
      window will be closed. Keep ctrl key still hold down.
(6) Now the first mintty window is focused. Then press 'd' key
      while holding ctrl key down.
(7) The first mintty window will not logout but displays 'd'.

I checked the pty and found the pty in the first mintty
receives just 'd' but not Ctrl-D from mintty. In other words,
fhandler_pty_master::write() is called with 'd'. So I suspect it
might be a problem of mintty. Therefore, I tried old version
of mintty. The results are:

...

Hi Takashi,
sorry this was attributed to pty, it is an issue of mintty I was aware
of which appeared in 3.7.2.
More precisely, it slipped in with
be73970877a99548aeeab60a2572ffb04b695066 "revise AltGr handling to
support flexible right-Alt+left-Ctrl combinations (#1266)", as a
trade-off for what I meant to be a final fix for control modifier
handling. I guess I hadn't considered it serious enough to reopen the
issue for another workaround. To be reconsidered...
I just had a look into that commit and saw the description of a hidden
option OldAltGrDetection right at the start.  Looks like
OldAltGrDetection=2 is a temporary workaround for the problem.  What's
the drawback of using it?
I've uploaded a fix to the github repository and tried to find an answer
to your question but couldn't yet...
Some background information: root cause of the trouble is Windows'
insane handling of the AltGr modifier and its failure to assign a
distinct virtual keycode to it. Instead it provides left-Control and
right-Alt key events, both with the same timestamp. That alone is a bit
tricky to detect as both Control and Alt are modifiers on their own.
Worse, software handling of AltGr detection or (in the case of remote
desktop software) generation often deviates from this scheme and even
Windows' own onscreen keyboard is buggy about this. Mintty has a number
of workarounds to handle that. Also, basically in a terminal emulator
the expectation is to handle all of Control, Alt etc and also their
combinations properly. For a example, on a keyboard where AltGr+q is
'@', Control+AltGr+q should be ^@, Alt+AltGr+q should be ESC @, and
Control+Alt+AltGr+q should be ESC ^@. All this is accomplished by
mintty. Together with the workarounds mentioned above, this is a
delicate area and I hope the fix found now interworks well with all such
software.
Thomas


Thanks,
Corinna



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

Reply via email to