produce escape sequences for some Ctrl-Meta- modified keys

This commit is contained in:
Mark Oteiza 2015-09-18 19:32:43 -04:00
parent ab78455a4a
commit 614eca0f03
1 changed files with 32 additions and 0 deletions

View File

@ -205,6 +205,34 @@ static const std::map<int, const char *> modify_table = {
{ GDK_KEY_question, "\033[27;6;63~" }, { GDK_KEY_question, "\033[27;6;63~" },
}; };
static const std::map<int, const char *> modify_meta_table = {
{ GDK_KEY_Tab, "\033[27;13;9~" },
{ GDK_KEY_Return, "\033[27;13;13~" },
{ GDK_KEY_apostrophe, "\033[27;13;39~" },
{ GDK_KEY_comma, "\033[27;13;44~" },
{ GDK_KEY_minus, "\033[27;13;45~" },
{ GDK_KEY_period, "\033[27;13;46~" },
{ GDK_KEY_0, "\033[27;13;48~" },
{ GDK_KEY_1, "\033[27;13;49~" },
{ GDK_KEY_9, "\033[27;13;57~" },
{ GDK_KEY_semicolon, "\033[27;13;59~" },
{ GDK_KEY_equal, "\033[27;13;61~" },
{ GDK_KEY_exclam, "\033[27;14;33~" },
{ GDK_KEY_quotedbl, "\033[27;14;34~" },
{ GDK_KEY_numbersign, "\033[27;14;35~" },
{ GDK_KEY_dollar, "\033[27;14;36~" },
{ GDK_KEY_percent, "\033[27;14;37~" },
{ GDK_KEY_ampersand, "\033[27;14;38~" },
{ GDK_KEY_parenleft, "\033[27;14;40~" },
{ GDK_KEY_parenright, "\033[27;14;41~" },
{ GDK_KEY_asterisk, "\033[27;14;42~" },
{ GDK_KEY_plus, "\033[27;14;43~" },
{ GDK_KEY_colon, "\033[27;14;58~" },
{ GDK_KEY_less, "\033[27;14;60~" },
{ GDK_KEY_greater, "\033[27;14;62~" },
{ GDK_KEY_question, "\033[27;14;63~" },
};
static gboolean modify_key_feed(GdkEventKey *event, keybind_info *info, static gboolean modify_key_feed(GdkEventKey *event, keybind_info *info,
const std::map<int, const char *>& table) { const std::map<int, const char *>& table) {
if (info->config.modify_other_keys) { if (info->config.modify_other_keys) {
@ -906,6 +934,10 @@ gboolean key_press_cb(VteTerminal *vte, GdkEventKey *event, keybind_info *info)
if (modify_key_feed(event, info, modify_table)) if (modify_key_feed(event, info, modify_table))
return TRUE; return TRUE;
} }
} else if ((modifiers == (GDK_CONTROL_MASK|GDK_MOD1_MASK)) ||
(modifiers == (GDK_CONTROL_MASK|GDK_MOD1_MASK|GDK_SHIFT_MASK))) {
if (modify_key_feed(event, info, modify_meta_table))
return TRUE;
} else if (modifiers == GDK_CONTROL_MASK) { } else if (modifiers == GDK_CONTROL_MASK) {
switch (gdk_keyval_to_lower(event->keyval)) { switch (gdk_keyval_to_lower(event->keyval)) {
case GDK_KEY_Tab: case GDK_KEY_Tab: