Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerToys sends a grave accent "`" before the first thing I type #8083

Closed
cln-b opened this issue Nov 17, 2020 · 50 comments
Closed

PowerToys sends a grave accent "`" before the first thing I type #8083

cln-b opened this issue Nov 17, 2020 · 50 comments
Assignees
Labels
Issue-Bug Something isn't working Product-FancyZones Refers to the FancyZones PowerToy Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. Status-Reproducible This issue was reproduced by a maintainer

Comments

@cln-b
Copy link

cln-b commented Nov 17, 2020

ℹ Computer information

  • PowerToys version: v0.25.0
  • Running PowerToys as Admin: Yes
  • Windows build number: 20H2 (19042.630)

📝 Provide detailed reproduction steps (if any)

  1. Use United Kingdom Extended keyboard layout
  2. Set PowerToys as a start-up program
  3. Reboot
  4. Type some text

✔️ Expected result

Whatever I type shouldn't have a grave accent on it, or before the first letter.

❌ Actual result

Whenever PowerToys is running, typing into a text field inserts a grave accent before the first letter.
For example "chrome" or "youtube" becomes "`chrome" or "ỳoutube"

📷 Screenshots

image
image

@cln-b cln-b added the Issue-Bug Something isn't working label Nov 17, 2020
@ghost ghost added Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Product-PowerToys Run Improved app launch PT Run (Win+R) Window labels Nov 17, 2020
@ghost
Copy link

ghost commented Nov 17, 2020

I guess you typed youtube in chrome. How's that to do with PowerToys?

@cln-b
Copy link
Author

cln-b commented Nov 17, 2020

This only happens when PowerToys is running, I should've explained it better

@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Nov 17, 2020
@ghost
Copy link

ghost commented Nov 17, 2020

That's strange.

@ghost
Copy link

ghost commented Nov 17, 2020

/cc @enricogior

@cln-b
Copy link
Author

cln-b commented Nov 17, 2020

I just found someone else with this issue, but it's solved. #3714

@crutkas
Copy link
Member

crutkas commented Nov 17, 2020

going to go through a few permutations here so please deal with us so we can see what could be the offending module.

  1. What modules do you have enabled
  2. Does it happen with Keyboard manager disabled?
  3. Do you have any type of additional software that could be running that could intercept low level keyhooks like AutoHotKey?

@crutkas crutkas added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Product-PowerToys Run Improved app launch PT Run (Win+R) Window labels Nov 17, 2020
@cln-b
Copy link
Author

cln-b commented Nov 17, 2020

  1. `File Explorer, Power Rename, PowerToys Run, Shortcut Guide
  2. Keyboard Manager isn't enabled
  3. Not that I know of, this only started happening when I installed PowerToys today

@ghost ghost added Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Needs-Team-Response An issue author responded so the team needs to follow up and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Nov 17, 2020
@crutkas crutkas added Product-PowerToys Run Improved app launch PT Run (Win+R) Window and removed Needs-Team-Response An issue author responded so the team needs to follow up Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Nov 21, 2020
@crutkas
Copy link
Member

crutkas commented Nov 21, 2020

notes: i tried this with a UK keyboard installed and couldn't repo the issue. BUT i failed at reading the repo steps E2E, i also didn't reboot.

@crutkas
Copy link
Member

crutkas commented Nov 21, 2020

even with a reboot, i can't reproduce this.

  1. confirmed KBM is turned off
  2. Using English (UK) - UK keyboard.
  3. My OS is EN-US set however.

@cillbill74 can you take a screenshot of your language setting page?

Here is mine:
image

Would love to hook a conference call / debugger into this to maybe dive in why if you'd be up for that.

@crutkas
Copy link
Member

crutkas commented Nov 21, 2020

Also here was my keyboard settings:
image

@crutkas crutkas added the Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. label Nov 21, 2020
@fsktom
Copy link

fsktom commented Nov 21, 2020

This may not help, but I think I also have the same problem

@crutkas
Copy link
Member

crutkas commented Nov 21, 2020

I need a way to repro the issue. More you can tell me about your set up or have a teams call with me, better chance of seeing the root cause.

@cln-b
Copy link
Author

cln-b commented Nov 21, 2020

I just tested and I do not have this problem with the "United Kingdom" keyboard layout, only with "United Kingdom Extended". Probably because the standard UK layout doesn't use "`" as a modifier.

Here's my language settings:
image
image

@cln-b
Copy link
Author

cln-b commented Nov 21, 2020

Just found something. If I try to map the grave key on the UK layout it says I'm pressing "`", but on the Extended layout it says I'm pressing "VK 223"? It seems like PowerToys has trouble with modifier keys as someone else had this problem with the "US International" layout's apostrophe modifier key. #3714

image
image

Edit: I disabled "VK 223" in Keyboard Manager but I still have this problem so scrap that idea

@crutkas
Copy link
Member

crutkas commented Nov 21, 2020

Ok, have to see why I can't see the extended keyboard then for the UK.

@Jay-o-Way
Copy link
Collaborator

A single keystroke of the grave accent would never result in a character being displayed, it always remains 'silent' until the next keystroke.

Yeah, not really. I set my keyboard layout.language to "English / US" because I was really fed up with these "dead keys", so now I don't have 'em any more.

@enricogior enricogior added Area-Runner The PowerToys main executable and removed Product-PowerToys Run Improved app launch PT Run (Win+R) Window labels Mar 8, 2021
@edo2313
Copy link

edo2313 commented Aug 27, 2021

I still have the problem

@crutkas
Copy link
Member

crutkas commented May 9, 2022

@Jay-o-Way, still possible to repro.

@crutkas crutkas removed their assignment May 9, 2022
@crutkas crutkas added the Help Wanted We encourage anyone to jump in on these and submit a PR. label May 9, 2022
@markvvaals
Copy link

As was noted by Davide above, I report and describe this issue in ticket 19014.

Please read the comment I just posted on that, as I have found the culprit and am able to reproduce 100% of the time following the steps described.

Note: I use United States-International keyboard layout in Windows, but this issue should be the same for all layouts that use/feature "dead keys".

@Jay-o-Way
Copy link
Collaborator

@SeraphimaZykova any clue?

@Jay-o-Way Jay-o-Way added the Status-Reproducible This issue was reproduced by a maintainer label Jun 27, 2022
@markvvaals
Copy link

Any news?
This has been bugging me for over a year.

Since I found how to reproduce the bug, shared detailed explanation of the bug and steps to reproduce as well as a video of it. Can you guys now find the issue with the code and solve it?
That would be greatly appreciated.

I'm happy to assist if necessary, let me know if you need anything else. Thanks!

@Jay-o-Way
Copy link
Collaborator

Jay-o-Way commented Jul 5, 2022

I tried and took a look at the code and searched for the decimal, hexadecimal and vk values, but didn't find the cause. But then I'm not the one who built FancyZones, Seraphima is. Confirming this is still happening in v0.60 and that it's the activation of FancyZones.

@Jay-o-Way Jay-o-Way added Product-FancyZones Refers to the FancyZones PowerToy and removed Area-Runner The PowerToys main executable labels Jul 11, 2022
@markvvaals
Copy link

Confirming this is still happening in v0.60 and that it's the activation of FancyZones.

Not sure if this was the confirmation or a question, but I can confirm this is still happening in v0.60 upon activation of FancyZones.

@jaimecbernardo
Copy link
Collaborator

Can repro as in #19014 with a US-International layout!

@jaimecbernardo
Copy link
Collaborator

I've hunted this down to the use of ToUnicodeEx when reading the vk code from settings:

auto output_bytes = ToUnicodeEx(key_code, scan_code, key_states.data(), output.data(), (int)output.size() - 1, 0, layout);

This is pretty weird, so this function can change the state of the keyboard. Let's see what we can do here.

https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-tounicodeex#remarks

As ToUnicodeEx translates the virtual-key code, it also changes the state of the kernel-mode keyboard buffer. This state-change affects dead keys, ligatures, alt+numpad key entry, and so on. It might also cause undesired side-effects if used in conjunction with TranslateMessage (which also changes the state of the kernel-mode keyboard buffer).

@jaimecbernardo
Copy link
Collaborator

What a weird detail. Anyway, it looks like sending the bit 2 of wFlags on seems to have fixed it. This is a recently introduced detail, but good thing it was added.

[in] wFlags
Type: UINT
The behavior of the function.
If bit 0 is set, a menu is active.
If bit 2 is set, keyboard state is not changed (Windows 10, version 1607 and newer)
All other bits (through 31) are reserved.

@jaimecbernardo
Copy link
Collaborator

Committing a fix soon.

@jaimecbernardo jaimecbernardo self-assigned this Jul 14, 2022
@jaimecbernardo jaimecbernardo added the Status-In progress This issue or work-item is under development label Jul 14, 2022
@jaimecbernardo
Copy link
Collaborator

@markvvaals , thanks a lot for the investigation, we've been able to reproduce it consistently and hunt down this weird bug thanks to you.

@jaimecbernardo jaimecbernardo removed the Help Wanted We encourage anyone to jump in on these and submit a PR. label Jul 14, 2022
@markvvaals
Copy link

@jaimecbernardo you're welcome, glad to be of help.
Thank you very much for hunting down the culprit code and finding a fix for this small but quite annoying bug for those of us using a keyboard layout with dead keys.

@jaimecbernardo jaimecbernardo added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Status-In progress This issue or work-item is under development labels Jul 15, 2022
@jaimecbernardo jaimecbernardo added this to Done in 0.61 Release Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Something isn't working Product-FancyZones Refers to the FancyZones PowerToy Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. Status-Reproducible This issue was reproduced by a maintainer
Projects
No open projects
Development

No branches or pull requests