diff options
| author | Brooks J Rady <b.j.rady@gmail.com> | 2021-03-09 19:39:42 +0000 |
|---|---|---|
| committer | Brooks J Rady <b.j.rady@gmail.com> | 2021-03-09 19:39:42 +0000 |
| commit | 06bce9a1fd88651a2e85c120776bc07399206806 (patch) | |
| tree | 6ecb2e8535d9cf2071d4ad5c22a295cd45089d18 /src/common/input/handler.rs | |
| parent | Rename init() to load() in plugin API + Bump deps (diff) | |
| download | sl0ppij-06bce9a1fd88651a2e85c120776bc07399206806.tar.gz sl0ppij-06bce9a1fd88651a2e85c120776bc07399206806.tar.xz sl0ppij-06bce9a1fd88651a2e85c120776bc07399206806.zip | |
Deduplicate the WASM interface structs
Diffstat (limited to 'src/common/input/handler.rs')
| -rw-r--r-- | src/common/input/handler.rs | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/src/common/input/handler.rs b/src/common/input/handler.rs index 52db9b4f..e498fbb6 100644 --- a/src/common/input/handler.rs +++ b/src/common/input/handler.rs @@ -10,9 +10,8 @@ use crate::screen::ScreenInstruction; use crate::wasm_vm::{EventType, PluginInputType, PluginInstruction}; use crate::CommandIsExecuting; -use serde::{Deserialize, Serialize}; -use strum_macros::EnumIter; use termion::input::TermReadEventsAndRaw; +use zellij_tile::data::{Help, InputMode}; use super::keybinds::key_to_actions; @@ -269,42 +268,6 @@ impl InputHandler { } } -/// Describes the different input modes, which change the way that keystrokes will be interpreted. -#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, EnumIter, Serialize, Deserialize)] -pub enum InputMode { - /// In `Normal` mode, input is always written to the terminal, except for one special input that - /// triggers the switch to [`InputMode::Command`] mode. - Normal, - /// In `Command` mode, input is bound to actions (more precisely, sequences of actions). - /// `Command` mode gives access to the other modes non-`InputMode::Normal` modes. - /// etc. - Command, - /// `Resize` mode allows resizing the different existing panes. - Resize, - /// `Pane` mode allows creating and closing panes, as well as moving between them. - Pane, - /// `Tab` mode allows creating and closing tabs, as well as moving between them. - Tab, - /// `Scroll` mode allows scrolling up and down within a pane. - Scroll, - RenameTab, -} - -/// Represents the contents of the help message that is printed in the status bar, -/// which indicates the current [`InputMode`] and what the keybinds for that mode -/// are. Related to the default `status-bar` plugin. -#[derive(Default, Debug, Clone, Serialize, Deserialize)] -pub struct Help { - pub mode: InputMode, - pub keybinds: Vec<(String, String)>, // <shortcut> => <shortcut description> -} - -impl Default for InputMode { - fn default() -> InputMode { - InputMode::Normal - } -} - /// Creates a [`Help`] struct indicating the current [`InputMode`] and its keybinds /// (as pairs of [`String`]s). // TODO this should probably be automatically generated in some way |
