diff options
author | Brooks J Rady <b.j.rady@gmail.com> | 2021-03-23 23:57:18 +0000 |
---|---|---|
committer | Brooks J Rady <b.j.rady@gmail.com> | 2021-03-23 23:57:18 +0000 |
commit | 23df8e447a1e73b8e3536fbf9781f1aafcee2765 (patch) | |
tree | eb462c458798ca3ff14f79f1e23d4d22c115f456 /zellij-tile/src | |
parent | ac55e590475fb68f29071fc06ded8f6d6bf5db22 (diff) |
Move most key handling to the update() + event system
Diffstat (limited to 'zellij-tile/src')
-rw-r--r-- | zellij-tile/src/data.rs | 4 | ||||
-rw-r--r-- | zellij-tile/src/lib.rs | 18 |
2 files changed, 2 insertions, 20 deletions
diff --git a/zellij-tile/src/data.rs b/zellij-tile/src/data.rs index abca9994e..a6e07983a 100644 --- a/zellij-tile/src/data.rs +++ b/zellij-tile/src/data.rs @@ -1,5 +1,5 @@ use serde::{Deserialize, Serialize}; -use strum_macros::{EnumDiscriminants, EnumIter, ToString}; +use strum_macros::{EnumDiscriminants, EnumIter, EnumString, ToString}; #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum Key { @@ -24,7 +24,7 @@ pub enum Key { } #[derive(Debug, Clone, EnumDiscriminants, ToString, Serialize, Deserialize)] -#[strum_discriminants(derive(Hash, Serialize, Deserialize))] +#[strum_discriminants(derive(EnumString, Hash, Serialize, Deserialize))] #[strum_discriminants(name(EventType))] pub enum Event { ModeUpdate(Help), // FIXME: Rename the `Help` struct diff --git a/zellij-tile/src/lib.rs b/zellij-tile/src/lib.rs index eb1b08fb7..771edb2dd 100644 --- a/zellij-tile/src/lib.rs +++ b/zellij-tile/src/lib.rs @@ -10,8 +10,6 @@ pub trait ZellijTile { fn update(&mut self, event: Event) {} fn render(&mut self, rows: usize, cols: usize) {} // FIXME: Everything below this line should be purged - fn handle_key(&mut self, key: Key) {} - fn handle_global_key(&mut self, key: Key) {} fn update_tabs(&mut self) {} fn handle_tab_rename_keypress(&mut self, key: Key) {} } @@ -46,22 +44,6 @@ macro_rules! register_tile { } #[no_mangle] - pub fn handle_key() { - STATE.with(|state| { - state.borrow_mut().handle_key($crate::shim::get_key()); - }); - } - - #[no_mangle] - pub fn handle_global_key() { - STATE.with(|state| { - state - .borrow_mut() - .handle_global_key($crate::shim::get_key()); - }); - } - - #[no_mangle] pub fn update_tabs() { STATE.with(|state| { state.borrow_mut().update_tabs(); |