summaryrefslogtreecommitdiffstats
path: root/zellij-tile/src
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2021-05-30 15:17:55 +0200
committera-kenji <aks.kenji@protonmail.com>2021-05-30 15:17:55 +0200
commit0be151fa28b6b0634271091f961048e8318fddc2 (patch)
tree382d3e3fe0a73ff127e19dd693589bcca824b842 /zellij-tile/src
parentce73b6cca0d6132a57a5a7a2321e1cec8b071720 (diff)
parentfe299325eb54e6642d27a417a3922a757b4390e4 (diff)
Merge branch 'main' of https://github.com/zellij-org/zellij into theme-config
Diffstat (limited to 'zellij-tile/src')
-rw-r--r--zellij-tile/src/data.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/zellij-tile/src/data.rs b/zellij-tile/src/data.rs
index 38b20dcdb..2111d9aa5 100644
--- a/zellij-tile/src/data.rs
+++ b/zellij-tile/src/data.rs
@@ -1,4 +1,5 @@
use serde::{Deserialize, Serialize};
+use std::str::FromStr;
use strum_macros::{EnumDiscriminants, EnumIter, EnumString, ToString};
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
@@ -92,6 +93,23 @@ impl Default for PaletteColor {
}
}
+impl FromStr for InputMode {
+ type Err = Box<dyn std::error::Error>;
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ match s {
+ "normal" => Ok(InputMode::Normal),
+ "resize" => Ok(InputMode::Resize),
+ "locked" => Ok(InputMode::Locked),
+ "pane" => Ok(InputMode::Pane),
+ "tab" => Ok(InputMode::Tab),
+ "scroll" => Ok(InputMode::Scroll),
+ "renametab" => Ok(InputMode::RenameTab),
+ e => Err(e.to_string().into()),
+ }
+ }
+}
+
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq, Hash)]
pub enum PaletteSource {
Default,