diff --git a/Cargo.lock b/Cargo.lock index e88454e..238dbd9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -159,12 +159,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" -[[package]] -name = "bytes" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" - [[package]] name = "castaway" version = "0.2.4" @@ -263,7 +257,6 @@ dependencies = [ "ratatui", "structopt", "syntect", - "tokio", "tui-tree-widget", "uuid", ] @@ -668,9 +661,9 @@ dependencies = [ [[package]] name = "edtui" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "417b85aa75bedb1da51eeed2d7a9241a061ddc6a0212e80057968ba34256fad8" +checksum = "e49905ece098e793ca21a019598e9efc9a66459ad1d76bd7619e771a42dae2fc" dependencies = [ "arboard", "crossterm", @@ -1485,12 +1478,6 @@ dependencies = [ "siphasher", ] -[[package]] -name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - [[package]] name = "pkg-config" version = "0.3.32" @@ -2211,32 +2198,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tokio" -version = "1.49.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" -dependencies = [ - "bytes", - "libc", - "mio", - "pin-project-lite", - "signal-hook-registry", - "tokio-macros", - "windows-sys 0.61.2", -] - -[[package]] -name = "tokio-macros" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.114", -] - [[package]] name = "tui-tree-widget" version = "0.24.0" @@ -2666,9 +2627,9 @@ dependencies = [ [[package]] name = "zmij" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd8f3f50b848df28f887acb68e41201b5aea6bc8a8dacc00fb40635ff9a72fea" +checksum = "94f63c051f4fe3c1509da62131a678643c5b6fbdc9273b2b79d4378ebda003d2" [[package]] name = "zune-core" diff --git a/Cargo.toml b/Cargo.toml index e4801f3..6c6ad8a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,6 @@ ratatui = "0.30.0" anyhow = "1.0.100" tui-tree-widget = "0.24.0" uuid = { version = "1.19.0", features = ["v4"] } -tokio = { version = "1.49.0", features = ["rt-multi-thread", "macros", "process"] } edtui = "0.11.0" [build-dependencies] diff --git a/src/tui/app.rs b/src/tui/app.rs index 08d74c7..2d7af4e 100644 --- a/src/tui/app.rs +++ b/src/tui/app.rs @@ -42,21 +42,10 @@ impl<'a> App<'a> { self.editor .event_handler .on_event(event.clone(), &mut self.editor.state); - - match event { - Event::FocusGained => {} - Event::FocusLost => {} - Event::Key(key_event) => { - // Handle main application key events. - match self.handle_key_events(key_event) { - Action::Noop => {} - Action::Quit => break, - Action::Pass => {} - } - } - Event::Mouse(_) => {} - Event::Paste(_) => {} - Event::Resize(_, _) => {} + match self.handle_event(event) { + Action::Noop => {} + Action::Quit => break, + Action::Pass => {} } } } diff --git a/src/tui/component.rs b/src/tui/component.rs index 0906154..6ec0289 100644 --- a/src/tui/component.rs +++ b/src/tui/component.rs @@ -1,4 +1,4 @@ -use ratatui::crossterm::event::{KeyEvent, MouseEvent}; +use ratatui::crossterm::event::{Event, KeyEvent, MouseEvent}; pub enum Action { Noop, @@ -7,6 +7,13 @@ pub enum Action { } pub trait ClideComponent { + fn handle_event(&mut self, event: Event) -> Action { + match event { + Event::Key(key_event) => self.handle_key_events(key_event), + _ => Action::Noop, + } + } + fn handle_key_events(&mut self, _key: KeyEvent) -> Action { Action::Noop }