aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-03-02 07:10:35 +0000
committerBlaž Hrastnik2022-03-03 07:52:41 +0000
commit68bad148a58cb580333cc545376b7bc6c2c5abd4 (patch)
tree808b124191ad76376bf812af844cb178e77239da /helix-term/src/ui
parent78fba8683bdce31ad2d8e710cb70fb9f05b21e8c (diff)
Extract idle timeout code into ui/editor.rs
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/editor.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 9ac72406..3d2e4298 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -856,6 +856,27 @@ impl EditorView {
doc.savepoint = None;
editor.clear_idle_timer(); // don't retrigger
}
+
+ pub fn handle_idle_timeout(&mut self, cx: &mut crate::compositor::Context) -> EventResult {
+ if self.completion.is_some()
+ || !cx.editor.config.auto_completion
+ || doc!(cx.editor).mode != Mode::Insert
+ {
+ return EventResult::Ignored(None);
+ }
+
+ let mut cx = commands::Context {
+ register: None,
+ editor: cx.editor,
+ jobs: cx.jobs,
+ count: None,
+ callback: None,
+ on_next_key_callback: None,
+ };
+ crate::commands::insert::idle_completion(&mut cx);
+
+ EventResult::Consumed(None)
+ }
}
impl EditorView {