feat: Fix completion for tags

This commit is contained in:
Dheepak Krishnamurthy 2022-02-06 22:49:27 -07:00
parent 12b61f5469
commit 3806db2bcb
2 changed files with 14 additions and 2 deletions

View file

@ -3447,9 +3447,18 @@ impl TaskwarriorTui {
for task in &self.tasks {
if let Some(tags) = task.tags() {
for tag in tags {
let t = format!("+{}", &tag);
if !virtual_tags.contains(tag) {
self.completion_list.insert(("tag".to_string(), t));
self.completion_list
.insert(("tag".to_string(), format!("tag:{}", &tag)));
}
}
}
}
for task in &self.tasks {
if let Some(tags) = task.tags() {
for tag in tags {
if !virtual_tags.contains(tag) {
self.completion_list.insert(("+".to_string(), format!("+{}", &tag)));
}
}
}

View file

@ -180,6 +180,9 @@ impl CompletionList {
} else if input.contains(':') {
self.input = input.split_once(':').unwrap().1.to_string();
self.helper.context = input.split_once(':').unwrap().0.to_string();
} else if input.contains('+') {
self.input = format!("+{}", input.split_once('+').unwrap().1);
self.helper.context = "+".to_string();
} else {
self.input = input;
self.helper.context = "attribute".to_string();