make table an argument of modify_other_keys
This commit is contained in:
parent
22c11916a3
commit
ab78455a4a
11
termite.cc
11
termite.cc
|
@ -205,12 +205,13 @@ static const std::map<int, const char *> modify_table = {
|
||||||
{ GDK_KEY_question, "\033[27;6;63~" },
|
{ GDK_KEY_question, "\033[27;6;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) {
|
||||||
if (info->config.modify_other_keys) {
|
if (info->config.modify_other_keys) {
|
||||||
unsigned int keyval = gdk_keyval_to_lower(event->keyval);
|
unsigned int keyval = gdk_keyval_to_lower(event->keyval);
|
||||||
auto entry = modify_table.find((int)keyval);
|
auto entry = table.find((int)keyval);
|
||||||
|
|
||||||
if (entry != modify_table.end()) {
|
if (entry != table.end()) {
|
||||||
vte_terminal_feed_child(info->vte, entry->second, -1);
|
vte_terminal_feed_child(info->vte, entry->second, -1);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -902,7 +903,7 @@ gboolean key_press_cb(VteTerminal *vte, GdkEventKey *event, keybind_info *info)
|
||||||
reload_config();
|
reload_config();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
if (modify_key_feed(event, info))
|
if (modify_key_feed(event, info, modify_table))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
} else if (modifiers == GDK_CONTROL_MASK) {
|
} else if (modifiers == GDK_CONTROL_MASK) {
|
||||||
|
@ -911,7 +912,7 @@ gboolean key_press_cb(VteTerminal *vte, GdkEventKey *event, keybind_info *info)
|
||||||
overlay_show(&info->panel, overlay_mode::completion, vte);
|
overlay_show(&info->panel, overlay_mode::completion, vte);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
if (modify_key_feed(event, info))
|
if (modify_key_feed(event, info, modify_table))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue