Commit 18a978ce authored by Ryan Scott's avatar Ryan Scott Committed by judah
Browse files

Properly process Unicode key events on Windows (#55)

Fixes #54.
parent f2cf8b50
next:
* Properly process Unicode key events on Windows.
Changed in version 0.7.3.1:
* Properly disable echoing in getPassword when running in MinTTY.
* Use `cast` from Data.Typeable instead of Data.Dynamic.
......
......@@ -73,8 +73,12 @@ consoleHandles = do
processEvent :: InputEvent -> Maybe Event
processEvent KeyEvent {keyDown = True, unicodeChar = c, virtualKeyCode = vc,
processEvent KeyEvent {keyDown = kd, unicodeChar = c, virtualKeyCode = vc,
controlKeyState = cstate}
| kd || ((testMod (#const LEFT_ALT_PRESSED) || vc == (#const VK_MENU))
&& c /= '\NUL')
-- Make sure not to ignore Unicode key events! The Unicode character might
-- only be emitted on a keyup event. See also GH issue #54.
= fmap (\e -> KeyInput [Key modifier' e]) $ keyFromCode vc `mplus` simpleKeyChar
where
simpleKeyChar = guard (c /= '\NUL') >> return (KeyChar c)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment