- if (_nc_build_wch(win, &wch) >= 0)
- code = wins_wch(win, &wch);
+ count = _nc_build_wch(win, &wch);
+ if (count > 0) {
+ code = _nc_insert_wch(win, &wch);
+ } else if (count == -1) {
+ /* handle EILSEQ */
+ if (is8bits(ch)) {
+ s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx ChCharOf(ch));
+ if (strlen(s) > 1) {
+ while (*s != '\0') {
+ code = _nc_insert_ch(sp, win,
+ ChAttrOf(ch) | UChar(*s));
+ if (code != OK)
+ break;
+ ++s;
+ }
+ } else {
+ code = ERR;
+ }
+ } else {
+ code = ERR;
+ }
+ }