aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/input/handler.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2021-03-11 16:03:28 +0100
committerGitHub <noreply@github.com>2021-03-11 16:03:28 +0100
commit8d0ff0fe405b4a6878cde34269a1ddb9e8cc3f0d (patch)
tree7d183a5e05a4b070a9e0327719e177cbf07c8dac /src/common/input/handler.rs
parentfeat(tabs): add ability to set tab name (#212) (diff)
downloadsl0ppij-8d0ff0fe405b4a6878cde34269a1ddb9e8cc3f0d.tar.gz
sl0ppij-8d0ff0fe405b4a6878cde34269a1ddb9e8cc3f0d.tar.xz
sl0ppij-8d0ff0fe405b4a6878cde34269a1ddb9e8cc3f0d.zip
feat(input): new shortcuts and ui (#220)
* feat(statusbar): new shortcuts * feat(input): new shortcuts and ui * style(fmt): rustfmt
Diffstat (limited to 'src/common/input/handler.rs')
-rw-r--r--src/common/input/handler.rs24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/common/input/handler.rs b/src/common/input/handler.rs
index 52db9b4f..57bb46fb 100644
--- a/src/common/input/handler.rs
+++ b/src/common/input/handler.rs
@@ -272,13 +272,12 @@ 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.
+ /// In `Normal` mode, input is always written to the terminal, except for the shortcuts leading
+ /// to other modes
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,
+ /// In `Locked` mode, input is always written to the terminal and all shortcuts are disabled
+ /// except the one leading back to normal mode
+ Locked,
/// `Resize` mode allows resizing the different existing panes.
Resize,
/// `Pane` mode allows creating and closing panes, as well as moving between them.
@@ -311,12 +310,7 @@ impl Default for InputMode {
pub fn get_help(mode: InputMode) -> Help {
let mut keybinds: Vec<(String, String)> = vec![];
match mode {
- InputMode::Normal | InputMode::Command => {
- keybinds.push(("p".to_string(), "PANE".to_string()));
- keybinds.push(("t".to_string(), "TAB".to_string()));
- keybinds.push(("r".to_string(), "RESIZE".to_string()));
- keybinds.push(("s".to_string(), "SCROLL".to_string()));
- }
+ InputMode::Normal | InputMode::Locked => {}
InputMode::Resize => {
keybinds.push(("←↓↑→".to_string(), "Resize".to_string()));
}
@@ -324,8 +318,8 @@ pub fn get_help(mode: InputMode) -> Help {
keybinds.push(("←↓↑→".to_string(), "Move focus".to_string()));
keybinds.push(("p".to_string(), "Next".to_string()));
keybinds.push(("n".to_string(), "New".to_string()));
- keybinds.push(("d".to_string(), "Split down".to_string()));
- keybinds.push(("r".to_string(), "Split right".to_string()));
+ keybinds.push(("d".to_string(), "Down split".to_string()));
+ keybinds.push(("r".to_string(), "Right split".to_string()));
keybinds.push(("x".to_string(), "Close".to_string()));
keybinds.push(("f".to_string(), "Fullscreen".to_string()));
}
@@ -342,8 +336,6 @@ pub fn get_help(mode: InputMode) -> Help {
keybinds.push(("Enter".to_string(), "when done".to_string()));
}
}
- keybinds.push(("ESC".to_string(), "BACK".to_string()));
- keybinds.push(("q".to_string(), "QUIT".to_string()));
Help { mode, keybinds }
}