From 21f2468d67e11eff7ede0d85fa6f4ab5c4f7de84 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 21 Nov 2019 23:01:56 +0100 Subject: input: add text produced by key to script key events Particularly for "any_unicode" mappings, so they don't have to special-case keys like '#' and ' ', which are normally mapped to symbolic names for input.conf reasons. (Though admittedly, this is a pretty minor thing, since API users could map these manually.) --- input/input.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'input/input.c') diff --git a/input/input.c b/input/input.c index 89ef1ace90..89c2571d2b 100644 --- a/input/input.c +++ b/input/input.c @@ -481,6 +481,11 @@ static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, char *force_section, ret->key_name = talloc_steal(ret, mp_input_get_key_combo_name(&code, 1)); MP_TRACE(ictx, "key '%s' -> '%s' in '%s'\n", ret->key_name, cmd->cmd, ret->input_section); + if (MP_KEY_IS_UNICODE(code)) { + bstr text = {0}; + mp_append_utf8_bstr(ret, &text, code); + ret->key_text = text.start; + } ret->is_mouse_button = code & MP_KEY_EMIT_ON_UP; } else { char *key_buf = mp_input_get_key_combo_name(&code, 1); -- cgit v1.2.3