aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorAlexander Brevig2023-03-05 01:52:20 +0000
committerGitHub2023-03-05 01:52:20 +0000
commita2e54167d8f9ad8764ba586488d3995aeb33a559 (patch)
treeac480bad6221da4193caf2abec2c6afe74a12092 /helix-term/src
parentbf872366fdc9d31383cc84a35bd8d30b1a9b9da6 (diff)
fix: Handle signals before crossterm events (#6170)
This is a workaround for a freeze when suspending Helix with C-z on non-Windows systems. The check for the keyboard enhancement protocol locks up crossterm's internal event reading/polling system by trying to set up multiple concurrent readers. `input_stream.next()` sets up one reader looking for regular crossterm events while the `supports_keyboard_enhancement` query sets up another looking for internal events. The latter hangs for two seconds or until the former yields an event. By handling signals first we don't lock up the mutex by trying to read keyboard events.
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/application.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index ee2a438c..df6d9da6 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -345,12 +345,12 @@ impl Application {
tokio::select! {
biased;
- Some(event) = input_stream.next() => {
- self.handle_terminal_events(event).await;
- }
Some(signal) = self.signals.next() => {
self.handle_signals(signal).await;
}
+ Some(event) = input_stream.next() => {
+ self.handle_terminal_events(event).await;
+ }
Some(callback) = self.jobs.futures.next() => {
self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback);
self.render().await;