summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2023-08-27 22:04:38 +0200
committerGitHub <noreply@github.com>2023-08-27 22:04:38 +0200
commitb587125f06f82e92a234786a7ead54449e89724e (patch)
tree6754e6d104a83a9466dcfbd80d83cfada21e97a5
parent1ccc973c686b5ee4e23889a6fb5144b384634566 (diff)
fix(panes): refocus pane properly on tab change (#2734)
* fix(panes): stacked panes focus bug * style(fmt): rustfmt
-rw-r--r--zellij-server/src/panes/floating_panes/mod.rs5
-rw-r--r--zellij-server/src/panes/tiled_panes/mod.rs5
-rw-r--r--zellij-server/src/screen.rs15
-rw-r--r--zellij-utils/src/cli.rs2
4 files changed, 15 insertions, 12 deletions
diff --git a/zellij-server/src/panes/floating_panes/mod.rs b/zellij-server/src/panes/floating_panes/mod.rs
index 1f2d770bb..ed21b010a 100644
--- a/zellij-server/src/panes/floating_panes/mod.rs
+++ b/zellij-server/src/panes/floating_panes/mod.rs
@@ -696,8 +696,9 @@ impl FloatingPanes {
self.focus_pane_for_all_clients(pane_id);
}
pub fn focus_pane_if_client_not_focused(&mut self, pane_id: PaneId, client_id: ClientId) {
- if self.active_panes.get(&client_id).is_none() {
- self.focus_pane(pane_id, client_id)
+ match self.active_panes.get(&client_id) {
+ Some(already_focused_pane_id) => self.focus_pane(*already_focused_pane_id, client_id),
+ None => self.focus_pane(pane_id, client_id),
}
}
pub fn defocus_pane(&mut self, pane_id: PaneId, client_id: ClientId) {
diff --git a/zellij-server/src/panes/tiled_panes/mod.rs b/zellij-server/src/panes/tiled_panes/mod.rs
index e85911b4f..71a53a330 100644
--- a/zellij-server/src/panes/tiled_panes/mod.rs
+++ b/zellij-server/src/panes/tiled_panes/mod.rs
@@ -588,8 +588,9 @@ impl TiledPanes {
}
}
pub fn focus_pane_if_client_not_focused(&mut self, pane_id: PaneId, client_id: ClientId) {
- if self.active_panes.get(&client_id).is_none() {
- self.focus_pane(pane_id, client_id)
+ match self.active_panes.get(&client_id) {
+ Some(already_focused_pane_id) => self.focus_pane(*already_focused_pane_id, client_id),
+ None => self.focus_pane(pane_id, client_id),
}
}
pub fn clear_active_panes(&mut self) {
diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs
index 5cf193856..a0e3b300e 100644
--- a/zellij-server/src/screen.rs
+++ b/zellij-server/src/screen.rs
@@ -1920,13 +1920,14 @@ pub(crate) fn screen_thread_main(
) => {
match client_or_tab_index {
ClientOrTabIndex::ClientId(client_id) => {
- active_tab_and_connected_client_id!(screen, client_id, |tab: &mut Tab,
- client_id: ClientId| tab .new_pane(pid,
- initial_pane_title,
- should_float,
- None,
- Some(client_id)),
- ?);
+ active_tab_and_connected_client_id!(screen, client_id, |tab: &mut Tab, client_id: ClientId| {
+ tab.new_pane(pid,
+ initial_pane_title,
+ should_float,
+ None,
+ Some(client_id)
+ )
+ }, ?);
if let Some(hold_for_command) = hold_for_command {
let is_first_run = true;
active_tab_and_connected_client_id!(
diff --git a/zellij-utils/src/cli.rs b/zellij-utils/src/cli.rs
index 957a13c1a..f8c59f543 100644
--- a/zellij-utils/src/cli.rs
+++ b/zellij-utils/src/cli.rs
@@ -292,7 +292,7 @@ pub enum CliAction {
requires("command")
)]
start_suspended: bool,
- #[clap(short, long, value_parser)]
+ #[clap(long, value_parser)]
configuration: Option<PluginUserConfiguration>,
},
/// Open the specified file in a new zellij pane with your default EDITOR