From 6e1050c254353471131672c0e8383c9e906d6fb5 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Wed, 22 Sep 2010 09:43:03 +1000 Subject: win32: lineedit: make read_key() pass Ctrl+ to read_line_input This makes ^C and ^D work properly regarding ash input handling (i.e. does not crash ash). Pressing ^C in ash does not stop running programs though. --- win32/termios.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'win32') diff --git a/win32/termios.c b/win32/termios.c index e2dc96361..34a17bbfd 100644 --- a/win32/termios.c +++ b/win32/termios.c @@ -31,6 +31,12 @@ int64_t FAST_FUNC read_key(int fd, char *buf, int timeout UNUSED_PARAM) continue; if (!record.Event.KeyEvent.uChar.AsciiChar) { DWORD state = record.Event.KeyEvent.dwControlKeyState; + + if (state & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED) && + (record.Event.KeyEvent.wVirtualKeyCode >= 'A' && + record.Event.KeyEvent.wVirtualKeyCode <= 'Z')) + return record.Event.KeyEvent.wVirtualKeyCode & ~0x40; + switch (record.Event.KeyEvent.wVirtualKeyCode) { case VK_DELETE: return KEYCODE_DELETE; case VK_INSERT: return KEYCODE_INSERT; -- cgit v1.2.3-55-g6feb