git-for-windows / git

A fork of Git containing Windows-specific patches.
http://gitforwindows.org/
Other
8.39k stars 2.54k forks source link

It is no longer possible to use Alt+Space to access context menu #2774

Closed daniel-montalvo closed 1 year ago

daniel-montalvo commented 4 years ago

Setup

$ git --version --build-options

git version 2.27.0.windows.1                                                                                            
cpu: x86_64                                                                                                             
built from commit: 907ab1011dce9112700498e034b974ba60f8b407                                                             
sizeof-long: 4                                                                                                          
sizeof-size_t: 8                                                                                                        
$ cmd.exe /c ver

Microsoft Windows
Version 2004 (OS Build 19041.388) 
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

Editor Option: Notepad++
Custom Editor Path: 
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: ConHost
Git Pull Behavior Option: Merge
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Enabled
Enable Pseudo Console Support: Disabled

Screen reader user

Details

bash

No commands

I want to be able to access context menu using Alt+Space, as I can do in the command prompt.

Pressing Alt+Space gives no results, and it is not possible to access the context menu using the screen reader

insert URL here

rimrul commented 4 years ago

Seems to be something else on your system causing this. I can open the system menu using Alt + Space on Windows 8.1 with Git-Bash configured for Conhost in versions 2.28.0, 2.27.0 and 2.25.0. What keyboard layout and what alt key are you using? I find using DE and UK layouts it works for left alt, but not AltGr, but using US layout it works with both left and right alt. (Same as with cmd.) If I configure Git-Bash to use MinTTY it only accepts left Alt, even with US layout.

gdh1995 commented 4 years ago

@rimrul I think this issue is saying about the new behavior since v2.27 with ConPTY API enabled, so it can only be reproduced on Win 10.

Here're my tests on a fresh v2.25 (unzipped from the portable version):

> REM press Win+R and type "cmd.exe" to open a CMD window
> set PATH=C:\Windows\System32
> .\git0\usr\bin\bash.exe --login -i
$ /mingw64/bin/git --version
git version 2.25.0.windows.1
$ # now if I press Alt+Space, then the window will show a popup menu, just like I'm clicking the window icon at top-left corner

While on v2.27/ v2.28

> REM press Win+R and type "cmd.exe" to open a CMD window
> set PATH=C:\Windows\System32
> .\git1\usr\bin\bash.exe --login -i
$ /mingw64/bin/git --version
git version 2.27.0.windows.1
$ # now if I press Alt+Space, nothing will happen
rimrul commented 4 years ago

Good catch. I assumed it wouldn't matter since they disabled ConPTY and MinTTY. I can actually reproduce this on Windows 10 as well. Both with Git-Bash configured to use ConHost and with bash.exe called from CMD.

rimrul commented 4 years ago

Ok, I've had a closer look, it seems like our bash package was not updated since 2018. I can also reproduce the issue using dash.exe, perl.exe, vim.exe and less.exe started from CMD.

This seems to be an issue with our MSYS2 runtime. I will try swapping out the msys-2.0.dll to confirm and then build a version of the runtime with the pseudo console patches reverted to see wether it activates pseudo console support despite being told not to or the issue has some other root cause.

rimrul commented 4 years ago

Bisecting the msys2-runtime package narrowed it down to ebd8f6b, e1dedf8 and f208686. The build artefacts for e1dedf8 also show this issue, so it's an issue introduced into the msys2 runtime between version 3.0.7 and 3.1.0. That at least narrows the terrible runtime bisecting dow to about 300 commits between 01c253a and f69b242.

rimrul commented 4 years ago

Good news: It can be reproduced with plain Cygwin that makes bisecting a lot easier.

rimrul commented 4 years ago

I've concluded the bisection: bd627864ab4189984cdb0892c00f91e39c4e8243 ( Cygwin: console: support 24 bit color, 2019-04-01) is the first bad commit.

gdh1995 commented 3 years ago

Any new progress? Today I met this again and still failed in solving it.

Anyway, the bash in WSL (hosted by a console.exe) also has such an issue. So it's somehow tolerable.

Putty, MinTTY, and Windows Terminal have special options and key mappings to hook Alt+Space before sending to a shell process. So, maybe console.exe should be blamed to this... almost nothing is configurable in it.

Added: I tried Using legacy console mode (requires relaunch) and with it Alt+Space works again, though the UI looks ugly.

dscho commented 3 years ago

@gdh1995 as per @rimrul's finding, this is a Cygwin issue. Since you are interested in seeing this resolved, please report a problem to the Cygwin project in the way they indicated: https://cygwin.com/problems.html

ploeh commented 3 years ago

Good news: It can be reproduced with plain Cygwin that makes bisecting a lot easier.

Could you share the details of how to do that?

I've been reading up on how to report this issue in the Cygwin project, but I think that the clearer the steps to reproduce are, the easier it'll be to communicate the problem.

dscho commented 3 years ago

You should be able to install Cygwin via their installer and then run their mintty.exe to reproduce.

ploeh commented 3 years ago

Is that different from the mintty.exe already in C:\Program Files\Git\usr\bin\?

FWIW, when I run C:\Program Files\Git\usr\bin\mintty.exe from cmd.exe, it first prompts me to pick one of three shells:

image

Regardless of what I click, I get a new Window, in which both Alt + Space and Shift + Ins works:

image

gdh1995 commented 3 years ago

um, it's conhost.exe which has this issue, but not mintty.exe.

if you double click usr/bin/bash.exe, then it will run in a black window, which is very like  what you see when running cmd.exe - it is just conhost.exe (a "terminal"), and cmd.exe or bash.exe are "shell".

---Original--- From: "Mark @.> Date: Wed, Nov 3, 2021 14:51 PM To: @.>; Cc: "Dahan @.**@.>; Subject: Re: [git-for-windows/git] It is no longer possible to use Alt+Space to access context menu (#2774)

Is that different from the mintty.exe already in C:\Program Files\Git\usr\bin\?

FWIW, when I run C:\Program Files\Git\usr\bin\mintty.exe from cmd.exe, it first prompts me to pick one of three shells:

Regardless of what I click, I get a new Window, in which both Alt + Space and Shift + Ins works:

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

dscho commented 3 years ago

Is that different from the mintty.exe already in C:\Program Files\Git\usr\bin\?

Yes, it is different, it is Cygwin's version.

um, it's conhost.exe which has this issue, but not mintty.exe.

@gdh1995 that's a good point, sorry for missing this.

And yes, I had a Cygwin v3.2.0 lying around and could confirm that it exposes the same problem. I then updated to v3.3.1, and it still has the same problem. So I think that the best option we have here is to report the problem to Cygwin (making sure to include the result of @rimrul's excellent analysis). Once they fix it on their side, we can cherry-pick the fix.

ploeh commented 3 years ago

I appreciate if this issue is not in Git for Windows, but rather in one of its dependencies.

Since this issue bothers me, I'd like to help by reporting it to the proper downstream dependency. In order to convince the maintainers of that project that an issue exists, I'll need to explain how to reproduce the problem.

This is still not clear to me.

While I'm a professional programmer, Git and Bash are tools to me. conhost.exe, mintty.exe, the distinction between terminal and shell are all implementation details to me. When I use Git Bash in Windows, I've no idea how and which components interact underneath.

You may ask how it's possible to be a professional programmer without understanding these things, but software development is a big field, and one can't know everything. I've spent most of my career developing web services and server-side background processes. I believe I know a thing or two about HTTP, networking, internals of the .NET platform, etc. but it's never been necessary for me to understand the inner workings of Git Bash...

I hope I'm not sounding ungrateful, but I think it'd be easier if someone who actually understands how this works reports the problem.

If I can help in any other way, I'd be happy to show my appreciation, for example by making a donation.

dscho commented 1 year ago

Closing as stale.