Skip to content

Use NCURSES_EXT_COLORS and NCURSES_EXT_FUNCS to check extended color support#134

Closed
shugo wants to merge 1 commit intomasterfrom
fix/support_extended_colors
Closed

Use NCURSES_EXT_COLORS and NCURSES_EXT_FUNCS to check extended color support#134
shugo wants to merge 1 commit intomasterfrom
fix/support_extended_colors

Conversation

@shugo
Copy link
Member

@shugo shugo commented Mar 6, 2026

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the curses extension’s compile-time detection of ncurses “extended color” support to use ncurses header feature macros instead of extconf-generated HAVE_* checks, and applies that flag across the extended color call sites.

Changes:

  • Add SUPPORT_EXTENDED_COLORS derived from NCURSES_EXT_COLORS and NCURSES_EXT_FUNCS.
  • Use SUPPORT_EXTENDED_COLORS to select between init_extended_*/extended_*_content and the classic APIs.
  • Simplify the Curses.support_extended_colors? documentation and implementation to rely on SUPPORT_EXTENDED_COLORS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +85 to +89
#if defined(NCURSES_EXT_COLORS) && defined(NCURSES_EXT_FUNCS)
# define SUPPORT_EXTENDED_COLORS 1
#else
# define SUPPORT_EXTENDED_COLORS 0
#endif
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUPPORT_EXTENDED_COLORS is derived only from NCURSES_EXT_COLORS/NCURSES_EXT_FUNCS (header-level macros) and no longer incorporates the extconf feature probes (HAVE_INIT_EXTENDED_PAIR, HAVE_INIT_EXTENDED_COLOR, etc.). That can make builds less robust in header/library mismatch scenarios (e.g., headers advertise extended support but the linked curses library lacks one of the extended_* symbols), leading to compile/link failures. Consider defining SUPPORT_EXTENDED_COLORS to also require the relevant HAVE_* macros (or keeping the per-call #ifdef HAVE_... guards) so we only call extended APIs when extconf verified they exist in the linked library.

Copilot uses AI. Check for mistakes.
@shugo shugo closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants