Fix completion crash

This commit is contained in:
Dheepak Krishnamurthy 2021-05-02 09:54:28 -06:00
parent 241ec96db6
commit 7e1581095a
2 changed files with 4 additions and 4 deletions

View file

@ -2697,10 +2697,10 @@ impl TaskwarriorTuiApp {
} }
pub fn update_completion_list(&mut self) { pub fn update_completion_list(&mut self) {
self.completion_list.clear();
match self.mode { match self.mode {
AppMode::TaskModify | AppMode::TaskFilter | AppMode::TaskAnnotate | AppMode::TaskAdd | AppMode::TaskLog => { AppMode::TaskModify | AppMode::TaskFilter | AppMode::TaskAnnotate | AppMode::TaskAdd | AppMode::TaskLog => {
let virtual_tags = self.task_report_table.virtual_tags.clone(); let virtual_tags = self.task_report_table.virtual_tags.clone();
self.completion_list.clear();
for task in self.tasks.iter() { for task in self.tasks.iter() {
if let Some(tags) = task.tags() { if let Some(tags) = task.tags() {
for tag in tags { for tag in tags {

View file

@ -32,8 +32,8 @@ pub fn get_start_word_under_cursor(line: &str, cursor_pos: usize) -> usize {
} }
pub struct TaskwarriorTuiCompletionHelper { pub struct TaskwarriorTuiCompletionHelper {
candidates: Vec<String>, pub candidates: Vec<String>,
completer: rustyline::completion::FilenameCompleter, pub completer: rustyline::completion::FilenameCompleter,
} }
impl Completer for TaskwarriorTuiCompletionHelper { impl Completer for TaskwarriorTuiCompletionHelper {
@ -167,7 +167,7 @@ impl CompletionList {
} }
pub fn is_empty(&self) -> bool { pub fn is_empty(&self) -> bool {
self.helper.candidates.is_empty() self.candidates().is_empty()
} }
pub fn candidates(&self) -> Vec<Pair> { pub fn candidates(&self) -> Vec<Pair> {