From ecfe90040e8962a046a0a7e4e3360ac1368b020d Mon Sep 17 00:00:00 2001 From: Hongjie Zhai Date: Thu, 29 Apr 2021 17:57:38 +0900 Subject: [PATCH] resolve conflit with main --- default-plugins/status-bar/src/mode_info.rs | 6 ++ src/common/input/keybinds.rs | 1 + zellij-tile/src/actions.rs | 67 --------------------- zellij-tile/src/data.rs | 6 +- 4 files changed, 11 insertions(+), 69 deletions(-) delete mode 100644 zellij-tile/src/actions.rs diff --git a/default-plugins/status-bar/src/mode_info.rs b/default-plugins/status-bar/src/mode_info.rs index c3ff2e3318..4998873fa2 100644 --- a/default-plugins/status-bar/src/mode_info.rs +++ b/default-plugins/status-bar/src/mode_info.rs @@ -18,6 +18,7 @@ const fn compare_key(l: &Key, r: &Key) -> bool { | (Key::Insert, Key::Insert) | (Key::Esc, Key::Esc) | (Key::BackTab, Key::BackTab) + | (Key::Char(_), Key::Char(_)) ) } @@ -29,6 +30,7 @@ const fn get_key_order(key: &Key) -> Option { (Key::Down, 1), (Key::PageUp, 2), (Key::PageDown, 2), + (Key::Char(' '), 3), ]; let mut i = 0; while i < V.len() { @@ -141,6 +143,10 @@ pub fn get_mode_info( get_major_key_by_action(&key_config, &[Action::ToggleFocusFullscreen]).to_string(), "Fullscreen".to_string(), )); + keybinds.push(( + get_major_key_by_action(&key_config, &[Action::ToggleActiveSyncPanes]).to_string(), + "Sync".to_string(), + )); } InputMode::Tab => { let key_map = get_key_map_string( diff --git a/src/common/input/keybinds.rs b/src/common/input/keybinds.rs index 22bb245bf6..cc4e7a0cba 100644 --- a/src/common/input/keybinds.rs +++ b/src/common/input/keybinds.rs @@ -1,6 +1,7 @@ //! Mapping of inputs to sequences of actions. use std::collections::HashMap; +use super::config; use serde::Deserialize; use strum::IntoEnumIterator; use zellij_tile::data::*; diff --git a/zellij-tile/src/actions.rs b/zellij-tile/src/actions.rs deleted file mode 100644 index a885eb1492..0000000000 --- a/zellij-tile/src/actions.rs +++ /dev/null @@ -1,67 +0,0 @@ -//! Definition of the actions that can be bound to keys. - -use super::data::InputMode; -use serde::{Deserialize, Serialize}; - -/// The four directions (left, right, up, down). -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub enum Direction { - Left, - Right, - Up, - Down, -} - -/// Actions that can be bound to keys. -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub enum Action { - /// Quit Zellij. - Quit, - /// Write to the terminal. - Write(Vec), - /// Switch to the specified input mode. - SwitchToMode(InputMode), - /// Resize focus pane in specified direction. - Resize(Direction), - /// Switch focus to next pane in specified direction. - FocusNextPane, - FocusPreviousPane, - /// Move the focus pane in specified direction. - SwitchFocus, - MoveFocus(Direction), - /// Scroll up in focus pane. - ScrollUp, - /// Scroll down in focus pane. - ScrollDown, - /// Scroll up one page in focus pane. - PageScrollUp, - /// Scroll down one page in focus pane. - PageScrollDown, - /// Toggle between fullscreen focus pane and normal layout. - ToggleFocusFullscreen, - /// Toggle between sending text commands to all panes and normal mode. - ToggleActiveSyncPanes, - /// Open a new pane in the specified direction (relative to focus). - /// If no direction is specified, will try to use the biggest available space. - NewPane(Option), - /// Close the focus pane. - CloseFocus, - /// Create a new tab. - NewTab, - /// Do nothing. - NoOp, - /// Go to the next tab. - GoToNextTab, - /// Go to the previous tab. - GoToPreviousTab, - /// Close the current tab. - CloseTab, - GoToTab(u32), - TabNameInput(Vec), -} - -impl Default for Action { - fn default() -> Self { - Action::NoOp - } -} diff --git a/zellij-tile/src/data.rs b/zellij-tile/src/data.rs index a126fb73e3..a7d48ca878 100644 --- a/zellij-tile/src/data.rs +++ b/zellij-tile/src/data.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use strum_macros::{EnumDiscriminants, EnumIter, EnumString, ToString}; /// The four directions (left, right, up, down). -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Deserialize, Serialize)] pub enum Direction { Left, Right, @@ -13,7 +13,7 @@ pub enum Direction { } /// Actions that can be bound to keys. -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Deserialize, Serialize)] pub enum Action { /// Quit Zellij. Quit, @@ -39,6 +39,8 @@ pub enum Action { PageScrollDown, /// Toggle between fullscreen focus pane and normal layout. ToggleFocusFullscreen, + /// Toggle between sending text commands to all panes and normal mode. + ToggleActiveSyncPanes, /// Open a new pane in the specified direction (relative to focus). /// If no direction is specified, will try to use the biggest available space. NewPane(Option),