about summary refs log tree commit diff
path: root/src/ui/window.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/window.rs')
-rw-r--r--src/ui/window.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/ui/window.rs b/src/ui/window.rs
index 6160bdc..8591038 100644
--- a/src/ui/window.rs
+++ b/src/ui/window.rs
@@ -163,6 +163,15 @@ impl FurtheranceWindow {
         imp.history_box.create_tasks_page();
     }
 
+    pub fn reset_autocomplete(&self) {
+        let imp = imp::FurtheranceWindow::from_obj(self);
+        if settings_manager::get_bool("autocomplete") {
+            imp.task_input.set_completion(Some(&FurtheranceWindow::create_autocomplete()));
+        } else {
+            imp.task_input.set_completion(None);
+        }
+    }
+
     fn setup_widgets(&self) {
         let imp = imp::FurtheranceWindow::from_obj(self);
 
@@ -214,10 +223,12 @@ impl FurtheranceWindow {
                     imp2.start_button.set_sensitive(true);
                 }
 
-                if task_input.text().len() >= FurtheranceWindow::MIN_PREFIX_LENGTH.try_into().unwrap() {
-                    let task_autocomplete = task_input.completion().unwrap();
-                    let model = Self::update_list_model(task_name.to_string(), split_tags).unwrap();
-                    task_autocomplete.set_model(Some(&model));
+                if settings_manager::get_bool("autocomplete") {
+                    if task_input.text().len() >= FurtheranceWindow::MIN_PREFIX_LENGTH.try_into().unwrap() {
+                        let task_autocomplete = task_input.completion().unwrap();
+                        let model = Self::update_list_model(task_name.to_string(), split_tags).unwrap();
+                        task_autocomplete.set_model(Some(&model));
+                    }
                 }
             }));