- /* handle EILSEQ */
- if (is8bits(CharOf(ch))) {
- const char *s = unctrl((chtype) CharOf(ch));
- if (s[1] != 0) {
- return waddstr(win, s);
+ attr_t attr = AttrOf(ch);
+
+ /* handle EILSEQ (i.e., when len >= -1) */
+ if (len == -1 && is8bits(CharOf(ch))) {
+ int rc = OK;
+ const char *s = NCURSES_SP_NAME(unctrl)
+ (NCURSES_SP_ARGx (chtype) CharOf(ch));
+
+ if (s[1] != '\0') {
+ while (*s != '\0') {
+ rc = waddch(win, UChar(*s) | attr);
+ if (rc != OK)
+ break;
+ ++s;
+ }
+ return rc;