Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(panes): refocus pane properly on tab change #2734

Merged
merged 2 commits into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions zellij-server/src/panes/floating_panes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions zellij-server/src/panes/tiled_panes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
15 changes: 8 additions & 7 deletions zellij-server/src/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
2 changes: 1 addition & 1 deletion zellij-utils/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down