Repository: zellij-org/zellij (language: rust)

Issue:
MoveFocusOrTab does not switch tab when a pane is in fullscreen
## Issue description

When having two tabs, with the first having two panes of which one is in fullscreen, pressing <kbd>Alt</kbd><kbd>→</kbd> does not move to the second tab.

The following keybinding from the default bindings:

```kdl
    shared_except "locked" {
		// ...
        bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; }
        bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; }
        // ...
    }
```

seems to not work when a pane is in fullscreen, even though there is another tab to switch to. Going to fullscreen does not automatically enter locked mode so I had the expectation that this would work.

## Minimal reproduction

1. Create two tabs
2. In the first tab, create two panes
3. Make the first pane fullscreen
4. Press <kbd>Alt</kbd>+<kbd>Right</kbd>
	* **Expected:** The second tab is focused
	* **Actual:** nothing happens 

## Other relevant information

Zellij: 0.40.1



Discussion / hints:

Fix patch:
diff --git a/zellij-server/src/panes/tiled_panes/mod.rs b/zellij-server/src/panes/tiled_panes/mod.rs
index 9c2458c2c8..abf324e460 100644
--- a/zellij-server/src/panes/tiled_panes/mod.rs
+++ b/zellij-server/src/panes/tiled_panes/mod.rs
@@ -1665,16 +1665,18 @@ impl TiledPanes {
         }
     }
 
-    pub fn focus_pane_left_fullscreen(&mut self, client_id: ClientId) {
+    pub fn focus_pane_left_fullscreen(&mut self, client_id: ClientId) -> bool {
         self.unset_fullscreen();
-        self.move_focus_left(client_id);
+        let ret = self.move_focus_left(client_id);
         self.toggle_active_pane_fullscreen(client_id);
+        return ret;
     }
 
-    pub fn focus_pane_right_fullscreen(&mut self, client_id: ClientId) {
+    pub fn focus_pane_right_fullscreen(&mut self, client_id: ClientId) -> bool {
         self.unset_fullscreen();
-        self.move_focus_right(client_id);
+        let ret = self.move_focus_right(client_id);
         self.toggle_active_pane_fullscreen(client_id);
+        return ret;
     }
 
     pub fn focus_pane_up_fullscreen(&mut self, client_id: ClientId) {
diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs
index 92e9eeb949..2daeebde0f 100644
--- a/zellij-server/src/tab/mod.rs
+++ b/zellij-server/src/tab/mod.rs
@@ -1919,19 +1919,19 @@ 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) {
+    pub fn focus_pane_left_fullscreen(&mut self, client_id: ClientId) -> bool {
         if !self.is_fullscreen_active() {
-            return;
+            return false;
         }
 
-        self.tiled_panes.focus_pane_left_fullscreen(client_id);
+        return self.tiled_panes.focus_pane_left_fullscreen(client_id);
     }
-    pub fn focus_pane_right_fullscreen(&mut self, client_id: ClientId) {
+    pub fn focus_pane_right_fullscreen(&mut self, client_id: ClientId) -> bool {
         if !self.is_fullscreen_active() {
-            return;
+            return false;
         }
 
-        self.tiled_panes.focus_pane_right_fullscreen(client_id);
+        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() {
@@ -2267,8 +2267,7 @@ impl Tab {
                 return Ok(false);
             }
             if self.tiled_panes.fullscreen_is_active() {
-                self.focus_pane_left_fullscreen(client_id);
-                return Ok(true);
+                return Ok(self.focus_pane_left_fullscreen(client_id));
             }
             Ok(self.tiled_panes.move_focus_left(client_id))
         }
@@ -2334,8 +2333,7 @@ impl Tab {
                 return Ok(false);
             }
             if self.tiled_panes.fullscreen_is_active() {
-                self.focus_pane_right_fullscreen(client_id);
-                return Ok(true);
+                return Ok(self.focus_pane_right_fullscreen(client_id));
             }
             Ok(self.tiled_panes.move_focus_right(client_id))
         }


Test patch: