mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
- Zero values no longer generate a 1-char bar in "task ghistory"
This commit is contained in:
parent
d199bada33
commit
00b7a5f1b4
3 changed files with 28 additions and 14 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,4 +9,5 @@ src/Makefile
|
|||
src/task
|
||||
stamp-h1
|
||||
Makefile
|
||||
configure
|
||||
config.log
|
||||
|
|
|
@ -242,8 +242,9 @@ std::string decode (color c)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string colorize (color fg, color bg, const std::string& input)
|
||||
{
|
||||
if (fg != nocolor || bg != nocolor)
|
||||
return decode (fg) + decode (bg) + input + decode (off);
|
||||
if (input.length ())
|
||||
if (fg != nocolor || bg != nocolor)
|
||||
return decode (fg) + decode (bg) + input + decode (off);
|
||||
|
||||
return input;
|
||||
}
|
||||
|
|
36
src/task.cpp
36
src/task.cpp
|
@ -1876,20 +1876,32 @@ void handleReportGHistory (const TDB& tdb, T& task, Config& conf)
|
|||
if (conf.get ("color", true))
|
||||
{
|
||||
char number[24];
|
||||
sprintf (number, "%d", addedGroup[i->first]);
|
||||
std::string aBar = number;
|
||||
while (aBar.length () < addedBar)
|
||||
aBar = " " + aBar;
|
||||
std::string aBar = "";
|
||||
if (addedGroup[i->first])
|
||||
{
|
||||
sprintf (number, "%d", addedGroup[i->first]);
|
||||
aBar = number;
|
||||
while (aBar.length () < addedBar)
|
||||
aBar = " " + aBar;
|
||||
}
|
||||
|
||||
sprintf (number, "%d", completedGroup[i->first]);
|
||||
std::string cBar = number;
|
||||
while (cBar.length () < completedBar)
|
||||
cBar = " " + cBar;
|
||||
std::string cBar = "";
|
||||
if (completedGroup[i->first])
|
||||
{
|
||||
sprintf (number, "%d", completedGroup[i->first]);
|
||||
cBar = number;
|
||||
while (cBar.length () < completedBar)
|
||||
cBar = " " + cBar;
|
||||
}
|
||||
|
||||
sprintf (number, "%d", deletedGroup[i->first]);
|
||||
std::string dBar = number;
|
||||
while (dBar.length () < deletedBar)
|
||||
dBar = " " + dBar;
|
||||
std::string dBar = "";
|
||||
if (deletedGroup[i->first])
|
||||
{
|
||||
sprintf (number, "%d", deletedGroup[i->first]);
|
||||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue