Skip to content
  • Kevin J. McCarthy's avatar
    Convert COLOR_DEFAULT constant to -1. · 543e1151
    Kevin J. McCarthy authored
    Previously, "mono" assigned -1 to fg/bg to indicate "unset" values.
    
    NCurses uses -1 to indicate "default" color (when supported), but
    COLOR_DEFAULT was assigned the value -2 and swapped at the last
    moment.  While it worked, I personally found this confusing.
    
    To make the logic clearer, create a COLOR_UNSET constant with value
    -2, and switch COLOR_DEFAULT to -1.  Then remove the last-minute
    translation when allocating the color.
    
    Change the "not set" initialization and testing to use COLOR_UNSET for
    clarity.
    
    Because map_getvaluebyname() returns -1 for a missing value,
    create a new lookup function that returns the matching mapping_t or
    NULL if not found.
    543e1151