aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-10-27 10:31:48 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-10-27 10:38:45 +0200
commit0a724e48a7b7a4e0ece4d2ae4c95a78ac83ed4fe (patch)
tree578fa21d40e3f2e2faccc4fd80b3618ca9cf9f62 /vis.c
parente497c51bb4af336e18fe5c5b8a3cce33afda180f (diff)
downloadvis-0a724e48a7b7a4e0ece4d2ae4c95a78ac83ed4fe.tar.gz
vis-0a724e48a7b7a4e0ece4d2ae4c95a78ac83ed4fe.tar.xz
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.
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c4
1 files 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);
}
}