mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Fix Alt handling in the new shifted-arrow-key support.
As well as affecting the bitmap field in the escape sequence, it was _also_ having its otherwise standard effect of prefixing Esc to the whole sequence. It shouldn't do both.
This commit is contained in:
parent
6c24cb5c9f
commit
a40b581fc1
2
putty.h
2
putty.h
@ -1945,7 +1945,7 @@ typedef enum SmallKeypadKey {
|
||||
SKK_HOME, SKK_END, SKK_INSERT, SKK_DELETE, SKK_PGUP, SKK_PGDN,
|
||||
} SmallKeypadKey;
|
||||
int format_arrow_key(char *buf, Terminal *term, int xkey,
|
||||
bool shift, bool ctrl, bool alt);
|
||||
bool shift, bool ctrl, bool alt, bool *consumed_alt);
|
||||
int format_function_key(char *buf, Terminal *term, int key_number,
|
||||
bool shift, bool ctrl);
|
||||
int format_small_keypad_key(char *buf, Terminal *term, SmallKeypadKey key);
|
||||
|
@ -7241,16 +7241,18 @@ void term_mouse(Terminal *term, Mouse_Button braw, Mouse_Button bcooked,
|
||||
term_schedule_update(term);
|
||||
}
|
||||
|
||||
static int shift_bitmap(bool shift, bool ctrl, bool alt)
|
||||
static int shift_bitmap(bool shift, bool ctrl, bool alt, bool *consumed_alt)
|
||||
{
|
||||
int bitmap = (shift ? 1 : 0) + (alt ? 2 : 0) + (ctrl ? 4 : 0);
|
||||
if (bitmap)
|
||||
bitmap++;
|
||||
if (alt && consumed_alt)
|
||||
*consumed_alt = true;
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
int format_arrow_key(char *buf, Terminal *term, int xkey,
|
||||
bool shift, bool ctrl, bool alt)
|
||||
bool shift, bool ctrl, bool alt, bool *consumed_alt)
|
||||
{
|
||||
char *p = buf;
|
||||
|
||||
@ -7283,7 +7285,7 @@ int format_arrow_key(char *buf, Terminal *term, int xkey,
|
||||
app_flg = !app_flg;
|
||||
break;
|
||||
case SHARROW_BITMAP:
|
||||
bitmap = shift_bitmap(shift, ctrl, alt);
|
||||
bitmap = shift_bitmap(shift, ctrl, alt, consumed_alt);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1808,6 +1808,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
||||
|
||||
switch (event->keyval) {
|
||||
int fkey_number;
|
||||
bool consumed_meta_key;
|
||||
|
||||
case GDK_KEY_F1: fkey_number = 1; goto numbered_function_key;
|
||||
case GDK_KEY_F2: fkey_number = 2; goto numbered_function_key;
|
||||
case GDK_KEY_F3: fkey_number = 3; goto numbered_function_key;
|
||||
@ -1875,10 +1877,14 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
||||
case GDK_KEY_Begin: case GDK_KEY_KP_Begin:
|
||||
xkey = 'G'; goto arrow_key;
|
||||
arrow_key:
|
||||
consumed_meta_key = false;
|
||||
end = 1 + format_arrow_key(output+1, inst->term, xkey,
|
||||
event->state & GDK_SHIFT_MASK,
|
||||
event->state & GDK_CONTROL_MASK,
|
||||
event->state & GDK_META_MASK);
|
||||
event->state & inst->meta_mod_mask,
|
||||
&consumed_meta_key);
|
||||
if (consumed_meta_key)
|
||||
start = 1; /* supersedes the usual prefixing of Esc */
|
||||
#ifdef KEY_EVENT_DIAGNOSTICS
|
||||
debug(" - arrow key");
|
||||
#endif
|
||||
|
@ -4429,6 +4429,8 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
||||
}
|
||||
|
||||
switch (wParam) {
|
||||
bool consumed_alt;
|
||||
|
||||
case VK_NUMPAD0: keypad_key = '0'; goto numeric_keypad;
|
||||
case VK_NUMPAD1: keypad_key = '1'; goto numeric_keypad;
|
||||
case VK_NUMPAD2: keypad_key = '2'; goto numeric_keypad;
|
||||
@ -4536,8 +4538,11 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
||||
case VK_LEFT: xkey = 'D'; goto arrow_key;
|
||||
case VK_CLEAR: xkey = 'G'; goto arrow_key; /* close enough */
|
||||
arrow_key:
|
||||
consumed_alt = false;
|
||||
p += format_arrow_key((char *)p, term, xkey, shift_state & 1,
|
||||
shift_state & 2, left_alt);
|
||||
shift_state & 2, left_alt, &consumed_alt);
|
||||
if (consumed_alt)
|
||||
left_alt = false; /* supersedes the usual prefixing of Esc */
|
||||
return p - output;
|
||||
|
||||
case VK_RETURN:
|
||||
|
Loading…
Reference in New Issue
Block a user