From cdbcd8a7625b4d3c7bbede1f230e96615c5c7585 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Thu, 2 Jun 2022 21:18:28 +0200 Subject: [PATCH] [plain] Fix issue with displaying text on non-utf8 terminals --- src/document/plain/renderer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/document/plain/renderer.c b/src/document/plain/renderer.c index 156c14101..84d80d745 100644 --- a/src/document/plain/renderer.c +++ b/src/document/plain/renderer.c @@ -478,7 +478,7 @@ add_document_line(struct plain_renderer *renderer, /* Now expand tabs */ for (line_pos = 0; line_pos < width;) { - char line_char = line[line_pos]; + unsigned char line_char = (unsigned char)line[line_pos]; int charlen = 1; int cell = 1; #ifdef CONFIG_UTF8 @@ -486,7 +486,7 @@ add_document_line(struct plain_renderer *renderer, if (utf8) { char *line_char2 = &line[line_pos]; - charlen = utf8charlen(&line_char); + charlen = utf8charlen((char *)&line_char); data = utf8_to_unicode(&line_char2, &line[width]); if (data == UCS_NO_CHAR) { @@ -537,7 +537,7 @@ add_document_line(struct plain_renderer *renderer, cells = 0; expanded = 0; for (line_pos = 0; line_pos < width;) { - char line_char = line[line_pos]; + unsigned char line_char = (unsigned char)line[line_pos]; char next_char, prev_char; int charlen = 1; int cell = 1; @@ -546,7 +546,7 @@ add_document_line(struct plain_renderer *renderer, if (utf8) { char *line_char2 = &line[line_pos]; - charlen = utf8charlen(&line_char); + charlen = utf8charlen((char *)&line_char); data = utf8_to_unicode(&line_char2, &line[width]); if (data == UCS_NO_CHAR) {