On 1/30/26 13:04, Robin Haberkorn via Bug reports for ncurses, the GNU
implementation of curses wrote:> Whereas CCHARW_MAX is ncurses-specific,
but 5 is probably
a safe value even on PDCurses.
PDCurses lacks combining characters, so CCHARW_MAX = 2 would
actually be a safe value. (One wchar_t for the actual character, plus
a '\0' terminator.)
PDCursesMod does have combining characters and lacks an upper limit;
theoretically speaking, you could pile on a slew of diacritics and
get "Zalgo text",
https://en.wikipedia.org/wiki/Zalgo_text
though the display would be confined to the character cell (and only
on some platforms and with suitable fonts).
However, looking at your example, it seems to me that any curses
implementation that has getcchar( ) ought to define CCHARW_MAX.
Otherwise, you have no idea how large an array to pass to getcchar().
So that's a fix for PDCursesMod (and ideally, for PDCurses as well).
(Theoretically speaking, you can call getcchar( ) with a NULL wch,
get the number of wide characters, and then allocate that array. But a
fixed maximum seems entirely reasonable to me.)
-- Bill
From this follows that you must depend on wide-char APIs
if you need this functionality even if not actually using
wide-chars.
It's relevant because I believe there are still non-wide-char
builds of ncurses in the wild.
Yours sincerely,
Robin Haberkorn