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
|
src/task
|
||||||
stamp-h1
|
stamp-h1
|
||||||
Makefile
|
Makefile
|
||||||
|
configure
|
||||||
config.log
|
config.log
|
||||||
|
|
|
@ -242,6 +242,7 @@ std::string decode (color c)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string colorize (color fg, color bg, const std::string& input)
|
std::string colorize (color fg, color bg, const std::string& input)
|
||||||
{
|
{
|
||||||
|
if (input.length ())
|
||||||
if (fg != nocolor || bg != nocolor)
|
if (fg != nocolor || bg != nocolor)
|
||||||
return decode (fg) + decode (bg) + input + decode (off);
|
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))
|
if (conf.get ("color", true))
|
||||||
{
|
{
|
||||||
char number[24];
|
char number[24];
|
||||||
|
std::string aBar = "";
|
||||||
|
if (addedGroup[i->first])
|
||||||
|
{
|
||||||
sprintf (number, "%d", addedGroup[i->first]);
|
sprintf (number, "%d", addedGroup[i->first]);
|
||||||
std::string aBar = number;
|
aBar = number;
|
||||||
while (aBar.length () < addedBar)
|
while (aBar.length () < addedBar)
|
||||||
aBar = " " + aBar;
|
aBar = " " + aBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string cBar = "";
|
||||||
|
if (completedGroup[i->first])
|
||||||
|
{
|
||||||
sprintf (number, "%d", completedGroup[i->first]);
|
sprintf (number, "%d", completedGroup[i->first]);
|
||||||
std::string cBar = number;
|
cBar = number;
|
||||||
while (cBar.length () < completedBar)
|
while (cBar.length () < completedBar)
|
||||||
cBar = " " + cBar;
|
cBar = " " + cBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string dBar = "";
|
||||||
|
if (deletedGroup[i->first])
|
||||||
|
{
|
||||||
sprintf (number, "%d", deletedGroup[i->first]);
|
sprintf (number, "%d", deletedGroup[i->first]);
|
||||||
std::string dBar = number;
|
dBar = number;
|
||||||
while (dBar.length () < deletedBar)
|
while (dBar.length () < deletedBar)
|
||||||
dBar = " " + dBar;
|
dBar = " " + dBar;
|
||||||
|
}
|
||||||
|
|
||||||
bar = Text::colorize (Text::black, Text::on_green, aBar);
|
bar = Text::colorize (Text::black, Text::on_green, aBar);
|
||||||
bar += Text::colorize (Text::black, Text::on_yellow, cBar);
|
bar += Text::colorize (Text::black, Text::on_yellow, cBar);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue