aboutsummaryrefslogtreecommitdiff
path: root/view.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2018-03-11 22:02:30 +0100
committerMarc André Tanner <mat@brain-dump.org>2018-03-11 22:18:50 +0100
commitd0efde07da335310b2e9da3bb9a690c2123fbc5e (patch)
tree47f4b2e3181cb45ec865a6122fbbf840f4698532 /view.c
parentfdb56b003c9e0a00ded2878b0c174a7780bb39b2 (diff)
downloadvis-d0efde07da335310b2e9da3bb9a690c2123fbc5e.tar.gz
vis-d0efde07da335310b2e9da3bb9a690c2123fbc5e.tar.xz
Reset parsing state after mbrtowc(3) failure
The standard says "if an encoding error occurs ... the conversion state is unspecified".
Diffstat (limited to 'view.c')
-rw-r--r--view.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/view.c b/view.c
index fafabc5..773f3a7 100644
--- a/view.c
+++ b/view.c
@@ -352,6 +352,7 @@ void view_draw(View *view) {
/* ok, we encountered an invalid multibyte sequence,
* replace it with the Unicode Replacement Character
* (FFFD) and skip until the start of the next utf8 char */
+ mbstate = (mbstate_t){0};
for (len = 1; rem > len && !ISUTF8(cur[len]); len++);
cell = (Cell){ .data = "\xEF\xBF\xBD", .len = len, .width = 1 };
} else if (len == (size_t)-2) {