aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/input/keybinds.rs
diff options
context:
space:
mode:
authordenis <denismaximov98@gmail.com>2021-03-27 14:43:16 +0200
committerdenis <denismaximov98@gmail.com>2021-03-27 14:43:16 +0200
commitb71315b03638c630b2e70dac1b464dd79d84d781 (patch)
tree00b2661efc4306c653ba61e3f7b16ddb3d615076 /src/common/input/keybinds.rs
parentwip: scary how messy it is, but it's a start (diff)
parentfeat(plugin): refactored to a new and more general plugin API (diff)
downloadsl0ppij-b71315b03638c630b2e70dac1b464dd79d84d781.tar.gz
sl0ppij-b71315b03638c630b2e70dac1b464dd79d84d781.tar.xz
sl0ppij-b71315b03638c630b2e70dac1b464dd79d84d781.zip
wip: latest plugin system merge in
Diffstat (limited to 'src/common/input/keybinds.rs')
-rw-r--r--src/common/input/keybinds.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/common/input/keybinds.rs b/src/common/input/keybinds.rs
index 4b676037..7b1e8779 100644
--- a/src/common/input/keybinds.rs
+++ b/src/common/input/keybinds.rs
@@ -1,12 +1,11 @@
//! Mapping of inputs to sequences of actions.
use super::actions::{Action, Direction};
-use super::handler::InputMode;
use std::collections::HashMap;
use strum::IntoEnumIterator;
-use termion::event::Key;
+use zellij_tile::data::*;
type Keybinds = HashMap<InputMode, ModeKeybinds>;
type ModeKeybinds = HashMap<Key, Vec<Action>>;
@@ -17,14 +16,14 @@ pub fn get_default_keybinds() -> Result<Keybinds, String> {
let mut defaults = Keybinds::new();
for mode in InputMode::iter() {
- defaults.insert(mode, get_defaults_for_mode(&mode)?);
+ defaults.insert(mode, get_defaults_for_mode(&mode));
}
Ok(defaults)
}
/// Returns the default keybinds for a givent [`InputMode`].
-fn get_defaults_for_mode(mode: &InputMode) -> Result<ModeKeybinds, String> {
+fn get_defaults_for_mode(mode: &InputMode) -> ModeKeybinds {
let mut defaults = ModeKeybinds::new();
match *mode {
@@ -227,10 +226,7 @@ fn get_defaults_for_mode(mode: &InputMode) -> Result<ModeKeybinds, String> {
defaults.insert(Key::Up, vec![Action::ScrollUp]);
}
InputMode::RenameTab => {
- defaults.insert(
- Key::Char('\n'),
- vec![Action::SaveTabName, Action::SwitchToMode(InputMode::Tab)],
- );
+ defaults.insert(Key::Char('\n'), vec![Action::SwitchToMode(InputMode::Tab)]);
defaults.insert(
Key::Ctrl('g'),
vec![Action::SwitchToMode(InputMode::Normal)],
@@ -245,7 +241,7 @@ fn get_defaults_for_mode(mode: &InputMode) -> Result<ModeKeybinds, String> {
}
}
- Ok(defaults)
+ defaults
}
/// Converts a [`Key`] terminal event to a sequence of [`Action`]s according to the current