mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-25 09:48:09 +02:00
Make ascii control char test nicer
This commit is contained in:
@@ -92,12 +92,17 @@ send_key_to_child(Window *w, int key, int mods, int action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
is_ascii_control_char(char c) {
|
||||||
|
return (0 <= c && c <= 31) || c == 127;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
on_key_input(int key, int scancode, int action, int mods, const char* text, int state UNUSED) {
|
on_key_input(int key, int scancode, int action, int mods, const char* text, int state UNUSED) {
|
||||||
Window *w = active_window();
|
Window *w = active_window();
|
||||||
if (!w) return;
|
if (!w) return;
|
||||||
Screen *screen = w->render_data.screen;
|
Screen *screen = w->render_data.screen;
|
||||||
bool has_text = text && (text[0] > 31 && text[0] != 127);
|
bool has_text = text && !is_ascii_control_char(text[0]);
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
if (has_text && IS_ALT_MODS(mods) && OPT(macos_option_as_alt)) has_text = false;
|
if (has_text && IS_ALT_MODS(mods) && OPT(macos_option_as_alt)) has_text = false;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user