Commit a2daa008 authored by Behdad Esfahbod's avatar Behdad Esfahbod Committed by Behdad Esfahbod
Browse files

Bug 337252 – ALT + Arrow keys don't work in irssi through gnome-terminal

2007-07-27  Behdad Esfahbod  <behdad@gnome.org>

        Bug 337252 – ALT + Arrow keys don't work in irssi through gnome-terminal
        Patch by James Bowes

        * src/keymap.c (_vte_keymap_map), (is_cursor_key),
        (_vte_keymap_key_add_key_modifiers):
        * src/keymap.h:
        * src/vte.c (vte_terminal_key_press):
        Only switch to CSI for some cursor keys when in cursor app mode.


svn path=/trunk/; revision=1921
parent 0d0e051a
2007-07-27 Behdad Esfahbod <behdad@gnome.org>
Bug 337252 ALT + Arrow keys don't work in irssi through gnome-terminal
Patch by James Bowes
* src/keymap.c (_vte_keymap_map), (is_cursor_key),
(_vte_keymap_key_add_key_modifiers):
* src/keymap.h:
* src/vte.c (vte_terminal_key_press):
Only switch to CSI for some cursor keys when in cursor app mode.
2007-06-25 Chris Wilson <chris@chris-wilson.co.uk>
Bug 448259 – Mapping for Ctrl-_
......
......@@ -1125,6 +1125,7 @@ _vte_keymap_map(guint keyval,
hp_mode,
legacy_mode,
vt220_mode,
cursor_mode & cursor_app,
normal,
normal_length);
_VTE_DEBUG_IF(VTE_DEBUG_KEYBOARD) {
......@@ -1328,6 +1329,31 @@ _vte_keymap_key_gets_modifiers(guint keyval)
return fkey;
}
/* Prior and Next are ommitted for the SS3 to CSI switch below */
gboolean
is_cursor_key(guint keyval)
{
switch (keyval) {
case GDK_Home:
case GDK_Left:
case GDK_Up:
case GDK_Right:
case GDK_Down:
case GDK_End:
case GDK_KP_Home:
case GDK_KP_Left:
case GDK_KP_Up:
case GDK_KP_Right:
case GDK_KP_Down:
case GDK_KP_End:
return TRUE;
default:
return FALSE;
}
}
void
_vte_keymap_key_add_key_modifiers(guint keyval,
GdkModifierType modifiers,
......@@ -1335,6 +1361,7 @@ _vte_keymap_key_add_key_modifiers(guint keyval,
gboolean hp_mode,
gboolean legacy_mode,
gboolean vt220_mode,
gboolean cursor_app_mode,
char **normal,
gssize *normal_length)
{
......@@ -1391,6 +1418,15 @@ _vte_keymap_key_add_key_modifiers(guint keyval,
nnormal = g_malloc0(*normal_length + 4);
memcpy(nnormal, *normal, *normal_length);
if (strlen(nnormal) > 1) {
/* SS3 should have no modifiers so make it CSI instead. See
* http://cvsweb.xfree86.org/cvsweb/xc/programs/xterm/input.c.diff?r1=3.57&r2=3.58
*/
if (cursor_app_mode &&
g_str_has_prefix(nnormal, _VTE_CAP_SS3)
&& is_cursor_key(keyval)) {
nnormal[1] = '[';
}
/* Get the offset of the last character. */
offset = strlen(nnormal) - 1;
if (g_ascii_isdigit(nnormal[offset - 1])) {
......
......@@ -56,6 +56,7 @@ void _vte_keymap_key_add_key_modifiers(guint keyval,
gboolean hp_mode,
gboolean legacy_mode,
gboolean vt220_mode,
gboolean app_cursor_keys,
char **normal,
gssize *normal_length);
......
......@@ -4447,6 +4447,7 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
terminal->pvt->hp_fkey_mode,
terminal->pvt->legacy_fkey_mode,
terminal->pvt->vt220_fkey_mode,
terminal->pvt->cursor_mode == VTE_KEYMODE_APPLICATION,
&normal,
&normal_length);
output = g_strdup_printf(normal, 1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment