Fix ctrl sequences (#196)

PowerShell/Win32-OpenSSH#850 - Fixed alt+shift+? control sequence at ssh client and ssh server side.
PowerShell/Win32-OpenSSH#849 - Fixed ctrl sequences (ctrl+pageup/ctrl+home, etc)...
This commit is contained in:
bagajjal 2017-08-18 12:21:26 -07:00 committed by Manoj Ampalam
parent f8371cf5c6
commit 5cbb8c9e52
3 changed files with 8 additions and 7 deletions

View File

@ -163,7 +163,8 @@ struct key_translation keys[] = {
{ L"\x1bOP", VK_F1, 0 , 0 , 0}, { L"\x1bOP", VK_F1, 0 , 0 , 0},
{ L"\x1bOQ", VK_F2, 0 , 0 , 0}, { L"\x1bOQ", VK_F2, 0 , 0 , 0},
{ L"\x1bOR", VK_F3, 0 , 0 , 0}, { L"\x1bOR", VK_F3, 0 , 0 , 0},
{ L"\x1bOS", VK_F4, 0 , 0 , 0}, { L"\x1bOS", VK_F4, 0 , 0 , 0},
{ L"\x1b?", VK_OEM_2, L'?' , 0 , SHIFT_PRESSED | LEFT_ALT_PRESSED},
{ L"\x1", VK_A, L'\x1' , 0 , LEFT_CTRL_PRESSED}, { L"\x1", VK_A, L'\x1' , 0 , LEFT_CTRL_PRESSED},
{ L"\x2", VK_B, L'\x2' , 0 , LEFT_CTRL_PRESSED}, { L"\x2", VK_B, L'\x2' , 0 , LEFT_CTRL_PRESSED},
//{ L"\x3", VK_C, L'\x3' , 0 , LEFT_CTRL_PRESSED}, /* Control + C is handled differently */ //{ L"\x3", VK_C, L'\x3' , 0 , LEFT_CTRL_PRESSED}, /* Control + C is handled differently */
@ -356,12 +357,8 @@ ProcessCtrlSequence(wchar_t *buf, int buf_len)
if (!vkey && buf_len == 6 && buf[2] == L'1' && isalpha(buf[5])) if (!vkey && buf_len == 6 && buf[2] == L'1' && isalpha(buf[5]))
vkey = GetVirtualKeyByMask(L'O', &buf[5], 1, 0); vkey = GetVirtualKeyByMask(L'O', &buf[5], 1, 0);
} }
if (vkey) { if (vkey)
SendKeyStrokeEx(child_in, VK_CONTROL, 0, LEFT_CTRL_PRESSED, TRUE); SendKeyStroke(child_in, vkey, 0, LEFT_CTRL_PRESSED);
SendKeyStrokeEx(child_in, vkey, 0, LEFT_CTRL_PRESSED, TRUE);
SendKeyStrokeEx(child_in, VK_CONTROL, 0, 0, FALSE);
SendKeyStrokeEx(child_in, vkey, 0, 0, FALSE);
}
} }
return vkey; return vkey;

View File

@ -208,6 +208,9 @@ ReadConsoleForTermEmul(HANDLE hInput, char *destin, int destinlen)
case VK_ESCAPE: case VK_ESCAPE:
NetWriteString2(pParams->Socket, (char *)ESCAPE_KEY, 1, 0); NetWriteString2(pParams->Socket, (char *)ESCAPE_KEY, 1, 0);
break; break;
case VK_OEM_2:
NetWriteString2(pParams->Socket, (char *)SHIFT_ALT_Q, 2, 0);
break;
case VK_SHIFT: case VK_SHIFT:
case VK_CONTROL: case VK_CONTROL:
case VK_CAPITAL: case VK_CAPITAL:

View File

@ -54,6 +54,7 @@
#define PREV_KEY "\x1b[5~" #define PREV_KEY "\x1b[5~"
#define NEXT_KEY "\x1b[6~" #define NEXT_KEY "\x1b[6~"
#define SHIFT_TAB_KEY "\x1b[~" #define SHIFT_TAB_KEY "\x1b[~"
#define SHIFT_ALT_Q "\x1b?"
#define ESCAPE_KEY "\x1b" #define ESCAPE_KEY "\x1b"
#define BACKSPACE_KEY "\b" #define BACKSPACE_KEY "\b"