1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Fix Xterm216+ Alt-Fn on Windows

On most keyboard modes the escape-sequence for Alt-Fn is the same as
for Fn alone but with an additional ESC prepended.

However, this additional ESC should not be sent for keyboard modes
that sends a different escape-sequence when Alt is pressed, like e.g.
Xterm216+, as this is not expected by the server-side application.

Signed-off-by: Anders Larsen <al@alarsen.net>
This commit is contained in:
Anders Larsen 2024-10-01 10:08:28 +02:00 committed by Simon Tatham
parent b7da41a1a3
commit 89c88253f6

View File

@ -4621,8 +4621,11 @@ static int TranslateKey(WinGuiSeat *wgs, UINT message, WPARAM wParam,
p += format_function_key((char *)p, wgs->term, fkey_number,
shift_state & 1, shift_state & 2,
left_alt, &consumed_alt);
if (consumed_alt)
left_alt = false; /* supersedes the usual prefixing of Esc */
if (consumed_alt) {
/* supersedes the usual prefixing of Esc */
p -= 1;
memmove(output, output + 1, p - output);
}
return p - output;
SmallKeypadKey sk_key;
@ -4637,11 +4640,15 @@ static int TranslateKey(WinGuiSeat *wgs, UINT message, WPARAM wParam,
if (shift_state & 2)
break;
consumed_alt = false;
p += format_small_keypad_key((char *)p, wgs->term, sk_key,
shift_state & 1, shift_state & 2,
left_alt, &consumed_alt);
if (consumed_alt)
left_alt = false; /* supersedes the usual prefixing of Esc */
if (consumed_alt) {
/* supersedes the usual prefixing of Esc */
p -= 1;
memmove(output, output + 1, p - output);
}
return p - output;
char xkey;
@ -4654,8 +4661,11 @@ static int TranslateKey(WinGuiSeat *wgs, UINT message, WPARAM wParam,
consumed_alt = false;
p += format_arrow_key((char *)p, wgs->term, xkey, shift_state & 1,
shift_state & 2, left_alt, &consumed_alt);
if (consumed_alt)
left_alt = false; /* supersedes the usual prefixing of Esc */
if (consumed_alt) {
/* supersedes the usual prefixing of Esc */
p -= 1;
memmove(output, output + 1, p - output);
}
return p - output;
case VK_RETURN: