mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Feature #679
+ Added feature #679, which makes color rules match project names in a left- most fashion, like filters (thanks to ch077179).
This commit is contained in:
parent
4f4a04738f
commit
83320a3e07
2 changed files with 9 additions and 2 deletions
|
@ -153,8 +153,13 @@ static void colorizeProject (Task& task, const std::string& rule, Color& c)
|
|||
// Observe the case sensitivity setting.
|
||||
bool sensitive = context.config.getBoolean ("search.case.sensitive");
|
||||
|
||||
if (compare (task.get ("project"), rule.substr (14), sensitive))
|
||||
c.blend (gsColor[rule]);
|
||||
std::string project = task.get ("project");
|
||||
std::string rule_trunc = rule.substr (14);
|
||||
|
||||
// Match project names leftmost, just like Context::autoFilter.
|
||||
if (rule_trunc.length () <= project.length ())
|
||||
if (compare (rule_trunc, project.substr (0, rule_trunc.length ()), sensitive))
|
||||
c.blend (gsColor[rule]);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue