diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index d19d8719..ac7cf817 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -373,6 +373,10 @@ _inp_offset_to_col(char* str, int offset) while (i < offset && str[i] != '\0') { gunichar uni = g_utf8_get_char(&str[i]); size_t ch_len = mbrlen(&str[i], MB_CUR_MAX, NULL); + if ((ch_len == (size_t)-2) || (ch_len == (size_t)-1)) { + i++; + continue; + } i += ch_len; col++; if (g_unichar_iswide(uni)) {