commit ebbe546033c8d0315e52b2b2cc2d3ec769cb914f
parent cf0eed6c36e28743464b17c510778451594fdec1
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Sun, 5 Jun 2016 13:23:58 +0200
screen: again, look at the bytes in their context
This avoids having to null-terminate every single-byte character.
Diffstat:
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/src/winio.c b/src/winio.c
@@ -1837,14 +1837,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
char *character = charalloc(mb_cur_max());
int charlen, i;
-#ifdef ENABLE_UTF8
- /* 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);
+ character = mbrep(buf + start_index, character, &charlen);
for (i = 0; i < charlen; i++)
converted[index++] = character[i];