diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2023-02-02 13:23:05 -0330 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2023-02-02 13:23:05 -0330 |
| commit | f0d3cd10c587936e54aaf1b2dae23a40dc0265b4 (patch) | |
| tree | 6d73304bea3c79426eac2900c064757e4e7747e2 | |
| parent | 9edca8db00a11d1c9b8ff029e838365db376c79f (diff) | |
| download | pfc-f0d3cd10c587936e54aaf1b2dae23a40dc0265b4.zip | |
make input handling match expression more concise
| -rw-r--r-- | Cargo.lock | 2 | ||||
| -rw-r--r-- | src/input.rs | 12 |
2 files changed, 4 insertions, 10 deletions
@@ -113,7 +113,7 @@ dependencies = [ [[package]] name = "pfc" -version = "0.1.0" +version = "0.2.0" dependencies = [ "crossterm", "tui", diff --git a/src/input.rs b/src/input.rs index 01d0b11..30262d2 100644 --- a/src/input.rs +++ b/src/input.rs @@ -15,15 +15,9 @@ impl Calculator { KeyCode::Char('q') => { return Signal::Exit; } - KeyCode::Char('j' | 'k') => { - self.swap(); - } - KeyCode::Char(c) => { - self.push_to_buffer(c); - } - KeyCode::Enter => { - self.push_buffer_to_stack(); - } + KeyCode::Char('j' | 'k') => self.swap(), + KeyCode::Char(c) => self.push_to_buffer(c), + KeyCode::Enter => self.push_buffer_to_stack(), KeyCode::Backspace => { self.input_buffer.pop(); } |