diff --git a/src/editor.rs b/src/editor.rs index fb17ed6..c3f38b5 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -6,7 +6,7 @@ pub struct Editor { impl Editor { pub fn default() -> Self { - Editor {should_quit: false} + Editor { should_quit: false } } pub fn run(&mut self) { if let Err(err) = self.repl() { @@ -19,10 +19,15 @@ impl Editor { enable_raw_mode()?; loop { if let Key(KeyEvent { - code, modifiers, kind, state + code, + modifiers, + kind, + state, }) = read()? { - println!("Code: {code:?} Modifiers: {modifiers:?} Kind: {kind:?} State: {state:?} \r"); + println!( + "Code: {code:?} Modifiers: {modifiers:?} Kind: {kind:?} State: {state:?} \r" + ); match code { Char('q') if modifiers == KeyModifiers::CONTROL => { self.should_quit = true; @@ -31,10 +36,10 @@ impl Editor { } if self.should_quit { break; - } + } } } disable_raw_mode()?; Ok(()) } -} \ No newline at end of file +}