Fix some Alt based shortcuts not working

This commit is contained in:
Kovid Goyal 2017-09-16 09:32:17 +05:30
parent 34084e7ab5
commit b7a5c064c2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -48,17 +48,20 @@ void
on_text_input(unsigned int codepoint, int mods) { on_text_input(unsigned int codepoint, int mods) {
Window *w = active_window(); Window *w = active_window();
static char buf[10]; static char buf[10];
unsigned int sz = 0;
if (w != NULL) { if (w != NULL) {
Screen *screen = w->render_data.screen; Screen *screen = w->render_data.screen;
bool handle_event = ( bool in_alt_mods = !screen->modes.mEXTENDED_KEYBOARD && (mods == GLFW_MOD_ALT || mods == (GLFW_MOD_ALT | GLFW_MOD_SHIFT)) ? true : false;
mods <= GLFW_MOD_SHIFT || bool is_text = mods <= GLFW_MOD_SHIFT ? true : false;
(!screen->modes.mEXTENDED_KEYBOARD && (mods == GLFW_MOD_ALT || mods == (GLFW_MOD_ALT | GLFW_MOD_SHIFT))) if (in_alt_mods) {
) ? true : false; // non text input is handle in on_key_input sz = encode_utf8(codepoint, buf + 1);
if (handle_event) { if (sz) {
unsigned int sz = encode_utf8(codepoint, buf); buf[0] = 033;
if (sz) schedule_write_to_child(w->id, buf, sz); sz++;
} }
} else if (is_text) sz = encode_utf8(codepoint, buf);
if (sz) schedule_write_to_child(w->id, buf, sz);
} }
} }