aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorSkyler Hawthorne2022-05-17 02:28:12 +0000
committerSkyler Hawthorne2022-06-19 03:57:47 +0000
commit526c9be8cadf99519e8f6a9911b3784ab7f2e142 (patch)
tree97ad572d2264223da504a962d00422f43536ab44 /helix-term/src
parent374724f5ac23b4b99022b4de58bcb17a1a3f99d5 (diff)
consolidate idle timer logic, make conditional
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/application.rs26
1 files changed, 18 insertions, 8 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index c611a691..15b44a85 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -251,6 +251,9 @@ impl Application {
where
S: Stream<Item = crossterm::Result<crossterm::event::Event>> + Unpin,
{
+ #[cfg(feature = "integration")]
+ let mut idle_handled = false;
+
loop {
if self.editor.should_close() {
return false;
@@ -263,11 +266,9 @@ impl Application {
Some(event) = input_stream.next() => {
self.handle_terminal_events(event);
- self.editor.reset_idle_timer();
}
Some(signal) = self.signals.next() => {
self.handle_signals(signal).await;
- self.editor.reset_idle_timer();
}
Some((id, call)) = self.editor.language_servers.incoming.next() => {
self.handle_language_server_message(call, id).await;
@@ -278,37 +279,46 @@ impl Application {
self.render();
self.last_render = Instant::now();
}
-
- self.editor.reset_idle_timer();
}
Some(payload) = self.editor.debugger_events.next() => {
let needs_render = self.editor.handle_debugger_message(payload).await;
if needs_render {
self.render();
}
- self.editor.reset_idle_timer();
}
Some(config_event) = self.editor.config_events.1.recv() => {
self.handle_config_events(config_event);
self.render();
- self.editor.reset_idle_timer();
}
Some(callback) = self.jobs.futures.next() => {
self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback);
self.render();
- self.editor.reset_idle_timer();
}
Some(callback) = self.jobs.wait_futures.next() => {
self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback);
self.render();
- self.editor.reset_idle_timer();
}
_ = &mut self.editor.idle_timer => {
// idle timeout
self.editor.clear_idle_timer();
self.handle_idle_timeout();
+
+ #[cfg(feature = "integration")]
+ {
+ idle_handled = true;
+ }
+ }
+ }
+
+ // for integration tests only, reset the idle timer after every
+ // event to make a signal when test events are done processing
+ #[cfg(feature = "integration")]
+ {
+ if idle_handled {
return true;
}
+
+ self.editor.reset_idle_timer();
}
}
}