From db573a88b8662a3f970f201c20af5153317bee04 Mon Sep 17 00:00:00 2001 From: Bert Gijsbers Date: Sat, 15 Jun 2024 20:12:27 +0200 Subject: [PATCH] Fix length calculation after getCharFromEvent. --- src/yinputline.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/yinputline.cc b/src/yinputline.cc index e1577937b..df45cf679 100644 --- a/src/yinputline.cc +++ b/src/yinputline.cc @@ -365,8 +365,9 @@ int YInputLine::getWCharFromEvent(const XKeyEvent& key, wchar_t* s, int maxLen) int len = 0; char buf[16]; if (getCharFromEvent(key, buf, 16)) { + len = int(strlen(buf)); YWideString w(buf, len); - memcpy(s, w.data(), w.length()); + memcpy(s, w.data(), w.length() * sizeof(wchar_t)); } return len; }