From e864f84f0923cf60932e11026a983ae8641a3a7f Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 9 May 2001 13:30:06 +0000 Subject: [PATCH] From RDB: according to VT manuals, application cursor keys should never be enabled when app keypad is disabled. Also CTRL+arrows flips the application-ness to make it easy to generate the other sequences if required. git-svn-id: svn://svn.tartarus.org/sgt/putty@1105 cda61777-01e9-0310-a592-d414129be87e --- window.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/window.c b/window.c index 3618d14b..5159d098 100644 --- a/window.c +++ b/window.c @@ -2759,10 +2759,22 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, if (xkey) { if (vt52_mode) p += sprintf((char *) p, "\x1B%c", xkey); - else if (app_cursor_keys && !cfg.no_applic_c) - p += sprintf((char *) p, "\x1BO%c", xkey); - else - p += sprintf((char *) p, "\x1B[%c", xkey); + else { + int app_flg = (app_cursor_keys && !cfg.no_applic_c); + /* VT100 & VT102 manuals both state the app cursor keys + * only work if the app keypad is on. + */ + if (!app_keypad_keys) + app_flg = 0; + /* Useful mapping of Ctrl-arrows */ + if (shift_state == 2) + app_flg = !app_flg; + + if (app_flg) + p += sprintf((char *) p, "\x1BO%c", xkey); + else + p += sprintf((char *) p, "\x1B[%c", xkey); + } return p - output; } } -- 2.11.0