diff --git a/tty-keys.c b/tty-keys.c index 19ad4f5b..941a9005 100644 --- a/tty-keys.c +++ b/tty-keys.c @@ -95,20 +95,25 @@ static const struct tty_default_key_raw tty_default_raw_keys[] = { { "\033OC", KEYC_RIGHT|KEYC_CURSOR }, { "\033OD", KEYC_LEFT|KEYC_CURSOR }, - { "\033\033OA", KEYC_UP|KEYC_CURSOR|KEYC_META|KEYC_IMPLIED_META }, - { "\033\033OB", KEYC_DOWN|KEYC_CURSOR|KEYC_META|KEYC_IMPLIED_META }, - { "\033\033OC", KEYC_RIGHT|KEYC_CURSOR|KEYC_META|KEYC_IMPLIED_META }, - { "\033\033OD", KEYC_LEFT|KEYC_CURSOR|KEYC_META|KEYC_IMPLIED_META }, - { "\033[A", KEYC_UP|KEYC_CURSOR }, { "\033[B", KEYC_DOWN|KEYC_CURSOR }, { "\033[C", KEYC_RIGHT|KEYC_CURSOR }, { "\033[D", KEYC_LEFT|KEYC_CURSOR }, - { "\033\033[A", KEYC_UP|KEYC_CURSOR|KEYC_META|KEYC_IMPLIED_META }, - { "\033\033[B", KEYC_DOWN|KEYC_CURSOR|KEYC_META|KEYC_IMPLIED_META }, - { "\033\033[C", KEYC_RIGHT|KEYC_CURSOR|KEYC_META|KEYC_IMPLIED_META }, - { "\033\033[D", KEYC_LEFT|KEYC_CURSOR|KEYC_META|KEYC_IMPLIED_META }, + /* + * Meta arrow keys. These do not get the IMPLIED_META flag so they + * don't match the xterm-style meta keys in the output tree - Escape+Up + * should stay as Escape+Up and not become M-Up. + */ + { "\033\033OA", KEYC_UP|KEYC_CURSOR|KEYC_META }, + { "\033\033OB", KEYC_DOWN|KEYC_CURSOR|KEYC_META }, + { "\033\033OC", KEYC_RIGHT|KEYC_CURSOR|KEYC_META }, + { "\033\033OD", KEYC_LEFT|KEYC_CURSOR|KEYC_META }, + + { "\033\033[A", KEYC_UP|KEYC_CURSOR|KEYC_META }, + { "\033\033[B", KEYC_DOWN|KEYC_CURSOR|KEYC_META }, + { "\033\033[C", KEYC_RIGHT|KEYC_CURSOR|KEYC_META }, + { "\033\033[D", KEYC_LEFT|KEYC_CURSOR|KEYC_META }, /* Other (xterm) "cursor" keys. */ { "\033OH", KEYC_HOME },