On Fri, Jan 30, 2026 at 06:04:01PM +0000, Robin Haberkorn via Bug reports for ncurses, the GNU implementation of curses wrote: > Hello! > > You can get a character cell's pair number via > PAIR_NUMBER(winch(w)), but only if you stay within > pair number 0-255. > > Did I understand correctly, that the only way to do that > for higher pair numbers is using the wide-character API?
yes, that's correct. basically PAIR_NUMBER was from SVr4, and getcchar, etc., are the X/Open stuff which provided for more pairs. > So for instance: > > cchar_t wch; > wchar_t wc[CCHARW_MAX]; > attr_t attrs = WA_NORMAL; > short pair = 0; > > if (win_wch(win, &wch) == OK) > getcchar(&wch, wc, &attrs, &pair, NULL); > > Whereas CCHARW_MAX is ncurses-specific, but 5 is probably > a safe value even on PDCurses. > > >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. sure - and they're limited to defining 255 pairs (pair 0 is special) -- Thomas E. Dickey <[email protected]> https://invisible-island.net
signature.asc
Description: PGP signature
