소스 검색

Merge pull request #3838 from tig/v2_3807-Accents

Fixes #3807 - Accents (é) don't work on `WindowsDriver`
Tig 10 달 전
부모
커밋
f2b24c4079
1개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 7 2
      Terminal.Gui/ConsoleDrivers/WindowsDriver.cs

+ 7 - 2
Terminal.Gui/ConsoleDrivers/WindowsDriver.cs

@@ -1725,8 +1725,13 @@ internal class WindowsDriver : ConsoleDriver
                 }
             }
 
-            // Return the Key (not KeyChar!)
-            return (KeyCode)keyInfo.Key;
+            // If KeyInfo.Key is A...Z and KeyInfo.KeyChar is not a...z then we have an accent.
+            // See https://github.com/gui-cs/Terminal.Gui/issues/3807#issuecomment-2455997595
+            if (keyInfo.KeyChar <= (char)'z')
+            {
+                return (KeyCode)keyInfo.Key;
+            }
+            return (KeyCode)keyInfo.KeyChar;
         }
 
         // Handle control keys whose VK codes match the related ASCII value (those below ASCII 33) like ESC