- Zero values no longer generate a 1-char bar in "task ghistory"
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,4 +9,5 @@ src/Makefile
|
||||
src/task
|
||||
stamp-h1
|
||||
Makefile
|
||||
configure
|
||||
config.log
|
||||
|
||||
@@ -242,6 +242,7 @@ std::string decode (color c)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string colorize (color fg, color bg, const std::string& input)
|
||||
{
|
||||
if (input.length ())
|
||||
if (fg != nocolor || bg != nocolor)
|
||||
return decode (fg) + decode (bg) + input + decode (off);
|
||||
|
||||
|
||||
18
src/task.cpp
18
src/task.cpp
@@ -1876,20 +1876,32 @@ void handleReportGHistory (const TDB& tdb, T& task, Config& conf)
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
char number[24];
|
||||
std::string aBar = "";
|
||||
if (addedGroup[i->first])
|
||||
{
|
||||
sprintf (number, "%d", addedGroup[i->first]);
|
||||
std::string aBar = number;
|
||||
aBar = number;
|
||||
while (aBar.length () < addedBar)
|
||||
aBar = " " + aBar;
|
||||
}
|
||||
|
||||
std::string cBar = "";
|
||||
if (completedGroup[i->first])
|
||||
{
|
||||
sprintf (number, "%d", completedGroup[i->first]);
|
||||
std::string cBar = number;
|
||||
cBar = number;
|
||||
while (cBar.length () < completedBar)
|
||||
cBar = " " + cBar;
|
||||
}
|
||||
|
||||
std::string dBar = "";
|
||||
if (deletedGroup[i->first])
|
||||
{
|
||||
sprintf (number, "%d", deletedGroup[i->first]);
|
||||
std::string dBar = number;
|
||||
dBar = number;
|
||||
while (dBar.length () < deletedBar)
|
||||
dBar = " " + dBar;
|
||||
}
|
||||
|
||||
bar = Text::colorize (Text::black, Text::on_green, aBar);
|
||||
bar += Text::colorize (Text::black, Text::on_yellow, cBar);
|
||||
|
||||
Reference in New Issue
Block a user