aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/input/handler.rs
diff options
context:
space:
mode:
authordenis <denismaximov98@gmail.com>2021-05-01 13:45:01 +0300
committerdenis <denismaximov98@gmail.com>2021-05-01 13:45:01 +0300
commiteabecde90b1617ce4c29be9d5af3f52ccb67e45f (patch)
tree0d0dafa594269045f084383a9719f2a4995fe7ea /src/common/input/handler.rs
parentwip: more cleaning up (diff)
parentdocs(changelog): performance improvements (diff)
downloadsl0ppij-eabecde90b1617ce4c29be9d5af3f52ccb67e45f.tar.gz
sl0ppij-eabecde90b1617ce4c29be9d5af3f52ccb67e45f.tar.xz
sl0ppij-eabecde90b1617ce4c29be9d5af3f52ccb67e45f.zip
chore: painless merge this time
Diffstat (limited to 'src/common/input/handler.rs')
-rw-r--r--src/common/input/handler.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/common/input/handler.rs b/src/common/input/handler.rs
index bbb594a3..eda71eea 100644
--- a/src/common/input/handler.rs
+++ b/src/common/input/handler.rs
@@ -59,7 +59,6 @@ impl InputHandler {
fn handle_input(&mut self) {
let mut err_ctx = OPENCALLS.with(|ctx| *ctx.borrow());
err_ctx.add_call(ContextType::StdinHandler);
- let keybinds = self.config.keybinds.clone();
let alt_left_bracket = vec![27, 91];
loop {
if self.should_exit {
@@ -71,14 +70,14 @@ impl InputHandler {
Ok((event, raw_bytes)) => match event {
termion::event::Event::Key(key) => {
let key = cast_termion_key(key);
- self.handle_key(&key, raw_bytes, &keybinds);
+ self.handle_key(&key, raw_bytes);
}
termion::event::Event::Unsupported(unsupported_key) => {
// we have to do this because of a bug in termion
// this should be a key event and not an unsupported event
if unsupported_key == alt_left_bracket {
let key = Key::Alt('[');
- self.handle_key(&key, raw_bytes, &keybinds);
+ self.handle_key(&key, raw_bytes);
}
}
termion::event::Event::Mouse(_) => {
@@ -91,8 +90,9 @@ impl InputHandler {
}
}
}
- fn handle_key(&mut self, key: &Key, raw_bytes: Vec<u8>, keybinds: &Keybinds) {
- for action in Keybinds::key_to_actions(&key, raw_bytes, &self.mode, &keybinds) {
+ fn handle_key(&mut self, key: &Key, raw_bytes: Vec<u8>) {
+ let keybinds = &self.config.keybinds;
+ for action in Keybinds::key_to_actions(&key, raw_bytes, &self.mode, keybinds) {
let should_exit = self.dispatch_action(action);
if should_exit {
self.should_exit = true;
@@ -245,6 +245,11 @@ impl InputHandler {
.send(ScreenInstruction::SwitchTabPrev)
.unwrap();
}
+ Action::ToggleActiveSyncPanes => {
+ self.send_screen_instructions
+ .send(ScreenInstruction::ToggleActiveSyncPanes)
+ .unwrap();
+ }
Action::CloseTab => {
self.command_is_executing.closing_pane();
self.send_screen_instructions
@@ -295,6 +300,7 @@ pub fn get_mode_info(mode: InputMode) -> ModeInfo {
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(("s".to_string(), "Sync".to_string()));
keybinds.push(("f".to_string(), "Fullscreen".to_string()));
}
InputMode::Tab => {