1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 03:22:48 -05:00

Centralise generation of the control sequences for arrow keys into a

function in terminal.c, and replace the cloned-and-hacked handling
code in all our front ends with calls to that.

This was intended for code cleanliness, but a side effect is to make
the GTK arrow-key handling support disabling of application cursor
key mode in the Features panel. Previously that checkbox was
accidentally ignored, and nobody seems to have noticed before!

[originally from svn r8896]
This commit is contained in:
Simon Tatham
2010-03-06 15:50:26 +00:00
parent c347755f87
commit 4d77b65677
5 changed files with 44 additions and 75 deletions

View File

@ -1052,19 +1052,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
case GDK_Begin: case GDK_KP_Begin: xkey = 'G'; break;
}
if (xkey) {
/*
* The arrow keys normally do ESC [ A and so on. In
* app cursor keys mode they do ESC O A instead.
* Ctrl toggles the two modes.
*/
if (inst->term->vt52_mode) {
end = 1 + sprintf(output+1, "\033%c", xkey);
} else if (!inst->term->app_cursor_keys ^
!(event->state & GDK_CONTROL_MASK)) {
end = 1 + sprintf(output+1, "\033O%c", xkey);
} else {
end = 1 + sprintf(output+1, "\033[%c", xkey);
}
end = 1 + format_arrow_key(output+1, inst->term, xkey,
event->state & GDK_CONTROL_MASK);
use_ucsoutput = FALSE;
goto done;
}