[PATCH v2 3/6] programs/conhost: handle csi escape sequence for shift tab
Eric Pouech
eric.pouech at gmail.com
Wed Feb 23 11:05:34 CST 2022
Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
---
programs/conhost/conhost.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c
index c2e7218f636..21401acd1e8 100644
--- a/programs/conhost/conhost.c
+++ b/programs/conhost/conhost.c
@@ -1561,8 +1561,11 @@ static void char_key_press( struct console *console, WCHAR ch, unsigned int ctrl
key_press( console, ch, vk, ctrl );
}
-static unsigned int escape_char_to_vk( WCHAR ch )
+static unsigned int escape_char_to_vk( WCHAR ch, unsigned int *ctrl, WCHAR *outuch )
{
+ if (ctrl) *ctrl = 0;
+ if (outuch) *outuch = '\0';
+
switch (ch)
{
case 'A': return VK_UP;
@@ -1575,6 +1578,8 @@ static unsigned int escape_char_to_vk( WCHAR ch )
case 'Q': return VK_F2;
case 'R': return VK_F3;
case 'S': return VK_F4;
+ case 'Z': if (ctrl && outuch) {*ctrl = SHIFT_PRESSED; *outuch = L'\t'; return VK_TAB;}
+ return 0;
default: return 0;
}
}
@@ -1612,7 +1617,8 @@ static unsigned int convert_modifiers( unsigned int n )
static unsigned int process_csi_sequence( struct console *console, const WCHAR *buf, size_t size )
{
- unsigned int n, count = 0, params[8], params_cnt = 0, vk;
+ unsigned int n, count = 0, params[8], params_cnt = 0, vk, ctrl;
+ WCHAR outuch;
for (;;)
{
@@ -1626,9 +1632,9 @@ static unsigned int process_csi_sequence( struct console *console, const WCHAR *
if (++count == size) return 0;
}
- if ((vk = escape_char_to_vk( buf[count] )))
+ if ((vk = escape_char_to_vk( buf[count], &ctrl, &outuch )))
{
- key_press( console, 0, vk, params_cnt >= 2 ? convert_modifiers( params[1] ) : 0 );
+ key_press( console, outuch, vk, params_cnt >= 2 ? convert_modifiers( params[1] ) : ctrl );
return count + 1;
}
@@ -1664,7 +1670,7 @@ static unsigned int process_input_escape( struct console *console, const WCHAR *
case 'O':
if (++count == size) break;
- vk = escape_char_to_vk( buf[1] );
+ vk = escape_char_to_vk( buf[1], NULL, NULL );
if (vk)
{
key_press( console, 0, vk, 0 );
More information about the wine-devel
mailing list