|
|
@ -187,17 +187,13 @@ impl Application {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn render(&mut self) {
|
|
|
|
fn render(&mut self) {
|
|
|
|
let editor = &mut self.editor;
|
|
|
|
|
|
|
|
let compositor = &mut self.compositor;
|
|
|
|
|
|
|
|
let jobs = &mut self.jobs;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mut cx = crate::compositor::Context {
|
|
|
|
let mut cx = crate::compositor::Context {
|
|
|
|
editor,
|
|
|
|
editor: &mut self.editor,
|
|
|
|
jobs,
|
|
|
|
jobs: &mut self.jobs,
|
|
|
|
scroll: None,
|
|
|
|
scroll: None,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
compositor.render(&mut cx);
|
|
|
|
self.compositor.render(&mut cx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub async fn event_loop(&mut self) {
|
|
|
|
pub async fn event_loop(&mut self) {
|
|
|
@ -278,31 +274,20 @@ impl Application {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn handle_idle_timeout(&mut self) {
|
|
|
|
pub fn handle_idle_timeout(&mut self) {
|
|
|
|
use crate::commands::{insert::idle_completion, Context};
|
|
|
|
use crate::compositor::EventResult;
|
|
|
|
use helix_view::document::Mode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if doc!(self.editor).mode != Mode::Insert || !self.config.editor.auto_completion {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let editor_view = self
|
|
|
|
let editor_view = self
|
|
|
|
.compositor
|
|
|
|
.compositor
|
|
|
|
.find::<ui::EditorView>()
|
|
|
|
.find::<ui::EditorView>()
|
|
|
|
.expect("expected at least one EditorView");
|
|
|
|
.expect("expected at least one EditorView");
|
|
|
|
|
|
|
|
|
|
|
|
if editor_view.completion.is_some() {
|
|
|
|
let mut cx = crate::compositor::Context {
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mut cx = Context {
|
|
|
|
|
|
|
|
register: None,
|
|
|
|
|
|
|
|
editor: &mut self.editor,
|
|
|
|
editor: &mut self.editor,
|
|
|
|
jobs: &mut self.jobs,
|
|
|
|
jobs: &mut self.jobs,
|
|
|
|
count: None,
|
|
|
|
scroll: None,
|
|
|
|
callback: None,
|
|
|
|
|
|
|
|
on_next_key_callback: None,
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
idle_completion(&mut cx);
|
|
|
|
if let EventResult::Consumed(_) = editor_view.handle_idle_timeout(&mut cx) {
|
|
|
|
self.render();
|
|
|
|
self.render();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn handle_terminal_events(&mut self, event: Option<Result<Event, crossterm::ErrorKind>>) {
|
|
|
|
pub fn handle_terminal_events(&mut self, event: Option<Result<Event, crossterm::ErrorKind>>) {
|
|
|
|