int insnstr(const char *str, int n);
Assuming libncursesw
use, what is n
? Is it (a) bytes count, (b) code-points (wchar_t
) count, (c) graphemes (cchar_t
) count, or (d) screen columns count?
(The (d) case is differ from (c) case if some cchar_t
has unicode width > 1 and occupies multiply columns.)
So first off, it appears (6.2 ncurses source) that insnstr is defined as a macro calling winsnstr. winsnstr() is defined in ncurses/base/lib_insnstr.c. there, within USE_WIDEC_SUPPORT guards, ncurses performs an mbstowcs bound by n. that result is fed into wins_nwstr().
so it appears that n in this context bounds the number of bytes going into the mbstowcs(). mbstowcs() wants entire multibyte sequences (not interrupted ones). so in this context, n still would appear to mean byte count, and ought come on a multibyte boundary.