Skip to content

Commit f2b24c4

Browse files
authored
Merge pull request #3838 from tig/v2_3807-Accents
Fixes #3807 - Accents (é) don't work on `WindowsDriver`
2 parents 27e6a61 + 0ad9a1f commit f2b24c4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Terminal.Gui/ConsoleDrivers/WindowsDriver.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,8 +1725,13 @@ private KeyCode MapKey (WindowsConsole.ConsoleKeyInfoEx keyInfoEx)
17251725
}
17261726
}
17271727

1728-
// Return the Key (not KeyChar!)
1729-
return (KeyCode)keyInfo.Key;
1728+
// If KeyInfo.Key is A...Z and KeyInfo.KeyChar is not a...z then we have an accent.
1729+
// See https://github.com/gui-cs/Terminal.Gui/issues/3807#issuecomment-2455997595
1730+
if (keyInfo.KeyChar <= (char)'z')
1731+
{
1732+
return (KeyCode)keyInfo.Key;
1733+
}
1734+
return (KeyCode)keyInfo.KeyChar;
17301735
}
17311736

17321737
// Handle control keys whose VK codes match the related ASCII value (those below ASCII 33) like ESC

0 commit comments

Comments
 (0)