Skip to content

Commit

Permalink
tty,win: fix Alt+key under WSL
Browse files Browse the repository at this point in the history
When releasing key with Alt pressed, the reported event has
LEFT_ALT_PRESSED state flag set. This confuses libuv, making it think
that Alt+numpad combination is used. This fixes this issue by removing
the check for state flag. Checking if VirtuakKeyCode is set to VK_MENU
is enough to detect the Alt+numpad case.

Fixes: libuv#2111
PR-URL: libuv#2114
Reviewed-By: Refael Ackermann <[email protected]>
  • Loading branch information
bzoz committed Jan 3, 2019
1 parent c560cf9 commit d2e59bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/win/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,8 +733,9 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle,

/* Ignore keyup events, unless the left alt key was held and a valid
* unicode character was emitted. */
if (!KEV.bKeyDown && !(((KEV.dwControlKeyState & LEFT_ALT_PRESSED) ||
KEV.wVirtualKeyCode==VK_MENU) && KEV.uChar.UnicodeChar != 0)) {
if (!KEV.bKeyDown &&
KEV.wVirtualKeyCode != VK_MENU &&
KEV.uChar.UnicodeChar != 0) {
continue;
}

Expand Down

0 comments on commit d2e59bb

Please sign in to comment.