Skip to content

Commit aad438b

Browse files
gh-154525: Fix curses getcchar() failure on ncurses older than 6.3 (GH-154526)
getcchar() rejected a non-NULL opts argument before ncurses 6.3, so read the color pair through the short slot instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 7745710 commit aad438b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Modules/_cursesmodule.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,9 @@ curses_getcchar(const cchar_t *wcval, wchar_t *wstr, attr_t *attrs, int *pair)
763763
/* getcchar() is not guaranteed to write the text of an empty cell, so make
764764
the output an empty string by default. */
765765
wstr[0] = L'\0';
766-
#if _NCURSES_EXTENDED_COLOR_FUNCS
766+
/* getcchar()'s opts slot returns the extended color pair, but ncurses
767+
returned ERR for a non-NULL opts until 6.3 (patch 20210116). */
768+
#if _NCURSES_EXTENDED_COLOR_FUNCS && NCURSES_VERSION_PATCH+0 >= 20210116
767769
int rtn = getcchar(wcval, wstr, attrs, &spair, pair);
768770
#else
769771
int rtn = getcchar(wcval, wstr, attrs, &spair, NULL);

0 commit comments

Comments
 (0)