mirror of
https://github.com/helix-editor/helix.git
synced 2025-01-19 13:37:06 +04:00
Simplify handle_terminal_events signature
This commit is contained in:
parent
0623a72599
commit
adb6cd5376
@ -213,7 +213,7 @@ pub async fn event_loop(&mut self) {
|
|||||||
tokio::select! {
|
tokio::select! {
|
||||||
biased;
|
biased;
|
||||||
|
|
||||||
event = reader.next() => {
|
Some(event) = reader.next() => {
|
||||||
self.handle_terminal_events(event)
|
self.handle_terminal_events(event)
|
||||||
}
|
}
|
||||||
Some(signal) = self.signals.next() => {
|
Some(signal) = self.signals.next() => {
|
||||||
@ -351,7 +351,7 @@ pub fn handle_idle_timeout(&mut self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_terminal_events(&mut self, event: Option<Result<Event, crossterm::ErrorKind>>) {
|
pub fn handle_terminal_events(&mut self, event: Result<Event, crossterm::ErrorKind>) {
|
||||||
let mut cx = crate::compositor::Context {
|
let mut cx = crate::compositor::Context {
|
||||||
editor: &mut self.editor,
|
editor: &mut self.editor,
|
||||||
jobs: &mut self.jobs,
|
jobs: &mut self.jobs,
|
||||||
@ -359,15 +359,14 @@ pub fn handle_terminal_events(&mut self, event: Option<Result<Event, crossterm::
|
|||||||
};
|
};
|
||||||
// Handle key events
|
// Handle key events
|
||||||
let should_redraw = match event {
|
let should_redraw = match event {
|
||||||
Some(Ok(Event::Resize(width, height))) => {
|
Ok(Event::Resize(width, height)) => {
|
||||||
self.compositor.resize(width, height);
|
self.compositor.resize(width, height);
|
||||||
|
|
||||||
self.compositor
|
self.compositor
|
||||||
.handle_event(Event::Resize(width, height), &mut cx)
|
.handle_event(Event::Resize(width, height), &mut cx)
|
||||||
}
|
}
|
||||||
Some(Ok(event)) => self.compositor.handle_event(event, &mut cx),
|
Ok(event) => self.compositor.handle_event(event, &mut cx),
|
||||||
Some(Err(x)) => panic!("{}", x),
|
Err(x) => panic!("{}", x),
|
||||||
None => panic!(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if should_redraw && !self.editor.should_close() {
|
if should_redraw && !self.editor.should_close() {
|
||||||
|
Loading…
Reference in New Issue
Block a user