Bug Fix - Color endianness

- Fixed "bug" that caused "red on black" to be emitted as ^[[40;31m
  instead of the expected ^[[31;40m, which is what the unit tests are
  looking for.
This commit is contained in:
Paul Beckingham 2009-10-11 11:49:35 -04:00
parent 1bb907f76d
commit 179b51278f
2 changed files with 8 additions and 8 deletions

View file

@ -465,18 +465,18 @@ std::string Color::colorize (const std::string& input)
result << "4"; result << "4";
} }
if (value & _COLOR_HASBG)
{
if (count++) result << ";";
result << ((value & _COLOR_BRIGHT ? 99 : 39) + ((value & _COLOR_BG) >> 8));
}
if (value & _COLOR_HASFG) if (value & _COLOR_HASFG)
{ {
if (count++) result << ";"; if (count++) result << ";";
result << (29 + (value & _COLOR_FG)); result << (29 + (value & _COLOR_FG));
} }
if (value & _COLOR_HASBG)
{
if (count++) result << ";";
result << ((value & _COLOR_BRIGHT ? 99 : 39) + ((value & _COLOR_BG) >> 8));
}
result << "m" << input << "\033[0m"; result << "m" << input << "\033[0m";
return result.str (); return result.str ();
} }

View file

@ -63,9 +63,9 @@ qx{../task rc:cal.rc add zero};
unlike ($output, qr/\[41m\d+/, 'No overdue tasks are present'); unlike ($output, qr/\[41m\d+/, 'No overdue tasks are present');
unlike ($output, qr/\[43m\d+/, 'No due tasks are present'); unlike ($output, qr/\[43m\d+/, 'No due tasks are present');
$output = qx{../task rc:cal.rc rc.weekstart:Sunday cal}; $output = qx{../task rc:cal.rc rc.weekstart:Sunday cal};
like ($output, qr/Su Mo Tu/, 'Week starts on Sunday'); like ($output, qr/Su Mo Tu/, 'Week starts on Sunday');
$output = qx{../task rc:cal.rc rc.weekstart:Monday cal}; $output = qx{../task rc:cal.rc rc.weekstart:Monday cal};
like ($output, qr/Fr Sa Su/, 'Week starts on Monday'); like ($output, qr/Fr Sa Su/, 'Week starts on Monday');
$output = qx{../task rc:cal.rc cal y}; $output = qx{../task rc:cal.rc cal y};
like ($output, qr/$month.* $year/, 'Current month and year are displayed'); like ($output, qr/$month.* $year/, 'Current month and year are displayed');
like ($output, qr/$prevmonth.* $nextyear/, 'Month and year one year ahead are displayed'); like ($output, qr/$prevmonth.* $nextyear/, 'Month and year one year ahead are displayed');