From 0a724e48a7b7a4e0ece4d2ae4c95a78ac83ed4fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 27 Oct 2016 10:31:48 +0200 Subject: vis: fix :langmap behavior The mapped to latin key has typically a shorter UTF-8 representation, thus explicitly copy the NUL terminator to properly truncate the new key value. --- vis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vis.c b/vis.c index 25f7840..15652e5 100644 --- a/vis.c +++ b/vis.c @@ -875,8 +875,8 @@ static const char *getkey(Vis *vis) { if (key.type == TERMKEY_TYPE_UNICODE && use_keymap) { const char *mapped = map_get(vis->keymap, key.utf8); if (mapped) { - size_t len = strlen(mapped); - if (len < sizeof(key.utf8)) + size_t len = strlen(mapped)+1; + if (len <= sizeof(key.utf8)) memcpy(key.utf8, mapped, len); } } -- cgit v1.2.3