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

fix: windows: AltGr maps to LEFT_CTRL+RIGHT_ALT #1162

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions key_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,11 @@ func keyType(e coninput.KeyEventRecord) KeyType {
case coninput.VK_DELETE:
return KeyDelete
default:
if e.ControlKeyState&(coninput.LEFT_CTRL_PRESSED|coninput.RIGHT_CTRL_PRESSED) == 0 {
switch {
case e.ControlKeyState.Contains(coninput.LEFT_CTRL_PRESSED) && e.ControlKeyState.Contains(coninput.RIGHT_ALT_PRESSED):
// AltGr is pressed, then it's a rune.
fallthrough
case !e.ControlKeyState.Contains(coninput.LEFT_CTRL_PRESSED) && !e.ControlKeyState.Contains(coninput.RIGHT_CTRL_PRESSED):
return KeyRunes
}

Expand Down Expand Up @@ -334,7 +338,7 @@ func keyType(e coninput.KeyEventRecord) KeyType {
case '\x1a':
return KeyCtrlZ
case '\x1b':
return KeyCtrlCloseBracket
return KeyCtrlOpenBracket // KeyEscape
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the // KeyEscape?

case '\x1c':
return KeyCtrlBackslash
case '\x1f':
Expand All @@ -344,6 +348,8 @@ func keyType(e coninput.KeyEventRecord) KeyType {
switch code {
case coninput.VK_OEM_4:
return KeyCtrlOpenBracket
case coninput.VK_OEM_6:
return KeyCtrlCloseBracket
}

return KeyRunes
Expand Down
Loading