on master help sign in
Simplify handle_terminal_events signature
adb6cd5Blaž Hrastnik
helix-term/src/application.rs+5−6
@@ -213,7 +213,7 @@ impl Application {
213 tokio::select! {
213 tokio::select! {
214 biased;
214 biased;
215
215
216− event = reader.next() => {
216+ Some(event) = reader.next() => {
217 self.handle_terminal_events(event)
217 self.handle_terminal_events(event)
218 }
218 }
219 Some(signal) = self.signals.next() => {
219 Some(signal) = self.signals.next() => {
@@ -351,7 +351,7 @@ impl Application {
351 }
351 }
352 }
352 }
353
353
354− pub fn handle_terminal_events(&mut self, event: Option<Result<Event, crossterm::ErrorKind>>) {
354+ pub fn handle_terminal_events(&mut self, event: Result<Event, crossterm::ErrorKind>) {
355 let mut cx = crate::compositor::Context {
355 let mut cx = crate::compositor::Context {
356 editor: &mut self.editor,
356 editor: &mut self.editor,
357 jobs: &mut self.jobs,
357 jobs: &mut self.jobs,
@@ -359,15 +359,14 @@ impl Application {
359 };
359 };
360 // Handle key events
360 // Handle key events
361 let should_redraw = match event {
361 let should_redraw = match event {
362− Some(Ok(Event::Resize(width, height))) => {
362+ Ok(Event::Resize(width, height)) => {
363 self.compositor.resize(width, height);
363 self.compositor.resize(width, height);
364
364
365 self.compositor
365 self.compositor
366 .handle_event(Event::Resize(width, height), &mut cx)
366 .handle_event(Event::Resize(width, height), &mut cx)
367 }
367 }
368− Some(Ok(event)) => self.compositor.handle_event(event, &mut cx),
368+ Ok(event) => self.compositor.handle_event(event, &mut cx),
369− Some(Err(x)) => panic!("{}", x),
369+ Err(x) => panic!("{}", x),
370− None => panic!(),
371 };
370 };
372
371
373 if should_redraw && !self.editor.should_close() {
372 if should_redraw && !self.editor.should_close() {