From ebbe546033c8d0315e52b2b2cc2d3ec769cb914f Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 5 Jun 2016 13:23:58 +0200 Subject: [PATCH] screen: again, look at the bytes in their context This avoids having to null-terminate every single-byte character. --- src/winio.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/winio.c b/src/winio.c index f10d2c98..71f1e873 100644 --- 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];