summaryrefslogtreecommitdiffstats
path: root/zellij-utils/src
diff options
context:
space:
mode:
authorKunal Mohan <44079328+kunalmohan@users.noreply.github.com>2021-10-19 20:20:28 +0530
committerGitHub <noreply@github.com>2021-10-19 20:20:28 +0530
commitd90e3d4cacbafd395a9df7ee3a02d5e908b5df2d (patch)
tree28c7a09ef3018cd6af868f7e4ab9ea7307733911 /zellij-utils/src
parent76a96b538b2bb8715f9fcd2d4f02603199671b46 (diff)
Feature: Move panes directionally (#762)
* Feature: Move panes directionally * change keybinds * Fix active pane after move * Add a separate 'Move' mode * Add tests * Add more tests * Send resize message to pty * wrap set_terminal_size_using_fd() in macro * change keybind for Move mode * cargo fmt * fix test * move render functions from tab.rs to screen.rs * undo wrong keybinds
Diffstat (limited to 'zellij-utils/src')
-rw-r--r--zellij-utils/src/errors.rs4
-rw-r--r--zellij-utils/src/input/actions.rs1
-rw-r--r--zellij-utils/src/input/mod.rs1
-rw-r--r--zellij-utils/src/input/unit/keybinds_test.rs4
4 files changed, 8 insertions, 2 deletions
diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs
index 1859a9042..b6353c5bc 100644
--- a/zellij-utils/src/errors.rs
+++ b/zellij-utils/src/errors.rs
@@ -226,6 +226,10 @@ pub enum ScreenContext {
MoveFocusUp,
MoveFocusRight,
MoveFocusRightOrNextTab,
+ MovePaneDown,
+ MovePaneUp,
+ MovePaneRight,
+ MovePaneLeft,
Exit,
ScrollUp,
ScrollUpAt,
diff --git a/zellij-utils/src/input/actions.rs b/zellij-utils/src/input/actions.rs
index 915f2dad3..ed1865f75 100644
--- a/zellij-utils/src/input/actions.rs
+++ b/zellij-utils/src/input/actions.rs
@@ -41,6 +41,7 @@ pub enum Action {
/// Tries to move the focus pane in specified direction.
/// If there is no pane in the direction, move to previous/next Tab.
MoveFocusOrTab(Direction),
+ MovePane(Direction),
/// Scroll up in focus pane.
ScrollUp,
/// Scroll up at point
diff --git a/zellij-utils/src/input/mod.rs b/zellij-utils/src/input/mod.rs
index 409c9afae..80e5e4515 100644
--- a/zellij-utils/src/input/mod.rs
+++ b/zellij-utils/src/input/mod.rs
@@ -23,6 +23,7 @@ pub fn get_mode_info(
let keybinds = match mode {
InputMode::Normal | InputMode::Locked => Vec::new(),
InputMode::Resize => vec![("←↓↑→".to_string(), "Resize".to_string())],
+ InputMode::Move => vec![("←↓↑→".to_string(), "Move".to_string())],
InputMode::Pane => vec![
("←↓↑→".to_string(), "Move focus".to_string()),
("p".to_string(), "Next".to_string()),
diff --git a/zellij-utils/src/input/unit/keybinds_test.rs b/zellij-utils/src/input/unit/keybinds_test.rs
index 6800bdf59..2cf84b703 100644
--- a/zellij-utils/src/input/unit/keybinds_test.rs
+++ b/zellij-utils/src/input/unit/keybinds_test.rs
@@ -378,7 +378,7 @@ fn unbind_multiple_keybinds_all_modes() {
let result_normal_2 = mode_keybinds_normal
.expect("ModeKeybinds shouldn't be empty")
.0
- .get(&Key::Ctrl('h'));
+ .get(&Key::Ctrl('f'));
let result_resize_1 = mode_keybinds_resize
.expect("ModeKeybinds shouldn't be empty")
.0
@@ -386,7 +386,7 @@ fn unbind_multiple_keybinds_all_modes() {
let result_resize_2 = mode_keybinds_resize
.expect("ModeKeybinds shouldn't be empty")
.0
- .get(&Key::Ctrl('h'));
+ .get(&Key::Ctrl('f'));
assert!(result_normal_1.is_none());
assert!(result_resize_1.is_none());
assert!(result_normal_2.is_none());