screen: again, look at the bytes in their context

This avoids having to null-terminate every single-byte character.
master
Benno Schulenberg 2016-06-05 13:23:58 +02:00
parent cf0eed6c36
commit ebbe546033
1 changed files with 1 additions and 8 deletions

View File

@ -1837,14 +1837,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
char *character = charalloc(mb_cur_max()); char *character = charalloc(mb_cur_max());
int charlen, i; int charlen, i;
#ifdef ENABLE_UTF8 character = mbrep(buf + start_index, character, &charlen);
/* Make sure an invalid sequence-starter byte is properly
* terminated, so that it doesn't pick up lingering bytes
* of any previous content. */
if (using_utf8() && buf_mb_len == 1)
buf_mb[1] = '\0';
#endif
character = mbrep(buf_mb, character, &charlen);
for (i = 0; i < charlen; i++) for (i = 0; i < charlen; i++)
converted[index++] = character[i]; converted[index++] = character[i];