From 4172268bd2552cf77540357f070abd216e834277 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Sat, 28 May 2016 15:56:16 +0200
Subject: [PATCH] chars: the representation of control characters is always two
 columns wide

---
 src/chars.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/src/chars.c b/src/chars.c
index 99c41f7d..60f9ec81 100644
--- a/src/chars.c
+++ b/src/chars.c
@@ -423,22 +423,10 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
 	     * current value of col. */
 	    if (*buf == '\t')
 		*col += tabsize - *col % tabsize;
-	    /* If we have a control character, get its width using one
-	     * column for the "^" that will be displayed in front of it,
-	     * and the width in columns of its visible equivalent as
-	     * returned by control_mbrep(). */
+	    /* If we have a control character, it's two columns wide: one
+	     * column for the "^", and one for the visible character. */
 	    else if (is_cntrl_mbchar(buf)) {
-		char *ctrl_buf_mb = charalloc(MB_CUR_MAX);
-		int ctrl_buf_mb_len;
-
-		(*col)++;
-
-		ctrl_buf_mb = control_mbrep(buf, ctrl_buf_mb,
-						&ctrl_buf_mb_len);
-
-		*col += mbwidth(ctrl_buf_mb);
-
-		free(ctrl_buf_mb);
+		*col += 2;
 	    /* If we have a normal character, get its width in columns
 	     * normally. */
 	    } else
-- 
GitLab