#22 pair_content(0,fg,bg) fails


The pair_content() function returns an error when
the pair argument is zero.

Passing 0 should allow the caller to determine the
foreground and background colours.

This call works as expected with ncurses.

Thanks, Warren.


  • Mark Hessling

    Mark Hessling - 2003-01-23
    • assigned_to: nobody --> rexx
  • Mark Hessling

    Mark Hessling - 2003-01-23

    Logged In: YES

    Hmm, according to the ncurses documentation at:
    pair_content() accepts as its first argument, a number
    between 1 and COLOR_PAIRS-1, so PDCurses is working as
    per the ncurses doco.
    I'll change the actual behaviour to reflect the actual behaviour
    of ncurses.

  • Warren W. Gay VE3WWG

    Logged In: YES

    Sorry, you are right. I should have looked more closely at
    the man pages. It does explicitly state that the first value
    start at 1. OTOH, this restriction does seem rather silly,
    because in effect you can use any colour pair between
    0 and COLOR_PAIRS - 1. It only makes sense to me
    that you should be able to query pair zero as well.

    No need to change it for my sake. I can use wgetbkgrnd
    and its counterpart, but it is much less convenient. Maybe,
    rather than rely on the pair_content to allow zero, I'll
    just modify my wrapper to do the "right thing" (TM).

  • Mark Hessling

    Mark Hessling - 2003-12-26

    Logged In: YES

    Cleaning up old bugs

  • Mark Hessling

    Mark Hessling - 2003-12-26
    • status: open --> closed
  • William McBrine

    William McBrine - 2007-05-14
    • assigned_to: rexx --> wmcbrine
    • status: closed --> closed-fixed
  • William McBrine

    William McBrine - 2007-05-14

    Logged In: YES
    Originator: NO

    pair_content(0, fg, bg) works in PDCurses 3.0+. (Note that init_pair() still won't accept 0.)


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks