From ba10390e1e22e5d66f0698b198ce0b4492a60065 Mon Sep 17 00:00:00 2001 From: nick black Date: Mon, 11 Oct 2021 02:45:21 -0400 Subject: [PATCH] wcstombs -> wcsrtombs in ncplane_putwstr_yx() --- include/notcurses/notcurses.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index 273a0bb97..5fa3bc22d 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -1975,7 +1975,10 @@ ncplane_putwstr_yx(struct ncplane* n, int y, int x, const wchar_t* gclustarr){ if(mbstr == NULL){ return -1; } - size_t s = wcstombs(mbstr, gclustarr, mbytes); + mbstate_t ps; + memset(&ps, 0, sizeof(ps)); + const wchar_t** gend = &gclustarr; + size_t s = wcsrtombs(mbstr, gend, mbytes, &ps); if(s == (size_t)-1){ free(mbstr); return -1;