summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYves Biener <56591091+yves-biener@users.noreply.github.com>2023-02-20 17:31:02 +0100
committerGitHub <noreply@github.com>2023-02-20 17:31:02 +0100
commitcf9f806559553d8df0c05780e02a107add93bafa (patch)
tree4901d0e8d3aa8f78c8d55e5cf8d279b8a9e2b6e2
parent03448497174de0f7034db4926ac21130a2ec417b (diff)
fix(ux): fullscreen navigation (#2117)
* fix(pane): fullscreen navigation in all four directions * fix(pane): use previous method in previous context
-rw-r--r--zellij-server/src/panes/tiled_panes/mod.rs24
-rw-r--r--zellij-server/src/tab/mod.rs40
2 files changed, 59 insertions, 5 deletions
diff --git a/zellij-server/src/panes/tiled_panes/mod.rs b/zellij-server/src/panes/tiled_panes/mod.rs
index bd6470c90..8ab5cb4f9 100644
--- a/zellij-server/src/panes/tiled_panes/mod.rs
+++ b/zellij-server/src/panes/tiled_panes/mod.rs
@@ -1452,6 +1452,30 @@ impl TiledPanes {
}
}
+ pub fn focus_pane_left_fullscreen(&mut self, client_id: ClientId) {
+ self.unset_fullscreen();
+ self.move_focus_left(client_id);
+ self.toggle_active_pane_fullscreen(client_id);
+ }
+
+ pub fn focus_pane_right_fullscreen(&mut self, client_id: ClientId) {
+ self.unset_fullscreen();
+ self.move_focus_right(client_id);
+ self.toggle_active_pane_fullscreen(client_id);
+ }
+
+ pub fn focus_pane_up_fullscreen(&mut self, client_id: ClientId) {
+ self.unset_fullscreen();
+ self.move_focus_up(client_id);
+ self.toggle_active_pane_fullscreen(client_id);
+ }
+
+ pub fn focus_pane_down_fullscreen(&mut self, client_id: ClientId) {
+ self.unset_fullscreen();
+ self.move_focus_down(client_id);
+ self.toggle_active_pane_fullscreen(client_id);
+ }
+
pub fn switch_next_pane_fullscreen(&mut self, client_id: ClientId) {
self.unset_fullscreen();
self.focus_next_pane(client_id);
diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs
index f6cad5aea..8a8133103 100644
--- a/zellij-server/src/tab/mod.rs
+++ b/zellij-server/src/tab/mod.rs
@@ -1543,6 +1543,34 @@ impl Tab {
pub fn are_floating_panes_visible(&self) -> bool {
self.floating_panes.panes_are_visible()
}
+ pub fn focus_pane_left_fullscreen(&mut self, client_id: ClientId) {
+ if !self.is_fullscreen_active() {
+ return;
+ }
+
+ self.tiled_panes.focus_pane_left_fullscreen(client_id);
+ }
+ pub fn focus_pane_right_fullscreen(&mut self, client_id: ClientId) {
+ if !self.is_fullscreen_active() {
+ return;
+ }
+
+ self.tiled_panes.focus_pane_right_fullscreen(client_id);
+ }
+ pub fn focus_pane_up_fullscreen(&mut self, client_id: ClientId) {
+ if !self.is_fullscreen_active() {
+ return;
+ }
+
+ self.tiled_panes.focus_pane_up_fullscreen(client_id);
+ }
+ pub fn focus_pane_down_fullscreen(&mut self, client_id: ClientId) {
+ if !self.is_fullscreen_active() {
+ return;
+ }
+
+ self.tiled_panes.focus_pane_down_fullscreen(client_id);
+ }
pub fn switch_next_pane_fullscreen(&mut self, client_id: ClientId) {
if !self.is_fullscreen_active() {
return;
@@ -1553,7 +1581,7 @@ impl Tab {
if !self.is_fullscreen_active() {
return;
}
- self.tiled_panes.switch_next_pane_fullscreen(client_id);
+ self.tiled_panes.switch_prev_pane_fullscreen(client_id);
}
pub fn set_force_render(&mut self) {
self.tiled_panes.set_force_render();
@@ -1833,7 +1861,7 @@ impl Tab {
return Ok(false);
}
if self.tiled_panes.fullscreen_is_active() {
- self.switch_next_pane_fullscreen(client_id);
+ self.focus_pane_left_fullscreen(client_id);
return Ok(true);
}
Ok(self.tiled_panes.move_focus_left(client_id))
@@ -1855,7 +1883,8 @@ impl Tab {
return Ok(false);
}
if self.tiled_panes.fullscreen_is_active() {
- return Ok(false);
+ self.focus_pane_down_fullscreen(client_id);
+ return Ok(true);
}
Ok(self.tiled_panes.move_focus_down(client_id))
}
@@ -1876,7 +1905,8 @@ impl Tab {
return Ok(false);
}
if self.tiled_panes.fullscreen_is_active() {
- return Ok(false);
+ self.focus_pane_up_fullscreen(client_id);
+ return Ok(true);
}
Ok(self.tiled_panes.move_focus_up(client_id))
}
@@ -1898,7 +1928,7 @@ impl Tab {
return Ok(false);
}
if self.tiled_panes.fullscreen_is_active() {
- self.switch_next_pane_fullscreen(client_id);
+ self.focus_pane_right_fullscreen(client_id);
return Ok(true);
}
Ok(self.tiled_panes.move_focus_right(client_id))