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(tabs): do not resize title bar when closing pane under it #252

Merged
merged 2 commits into from
Apr 5, 2021
Merged
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
99 changes: 64 additions & 35 deletions src/client/tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2064,47 +2064,76 @@ impl Tab {
}
}
pub fn close_pane_without_rerender(&mut self, id: PaneId) {
if let Some(terminal_to_close) = self.panes.get(&id) {
let terminal_to_close_width = terminal_to_close.columns();
let terminal_to_close_height = terminal_to_close.rows();
if let Some(terminals) = self.panes_to_the_left_between_aligning_borders(id) {
for terminal_id in terminals.iter() {
self.increase_pane_width_right(&terminal_id, terminal_to_close_width + 1);
// 1 for the border
}
if self.active_terminal == Some(id) {
self.active_terminal = self.next_active_pane(terminals);
}
} else if let Some(terminals) = self.panes_to_the_right_between_aligning_borders(id) {
for terminal_id in terminals.iter() {
self.increase_pane_width_left(&terminal_id, terminal_to_close_width + 1);
// 1 for the border
}
if self.active_terminal == Some(id) {
self.active_terminal = self.next_active_pane(terminals);
}
} else if let Some(terminals) = self.panes_above_between_aligning_borders(id) {
for terminal_id in terminals.iter() {
self.increase_pane_height_down(&terminal_id, terminal_to_close_height + 1);
// 1 for the border
if let Some(pane_to_close) = self.panes.get(&id) {
let pane_to_close_width = pane_to_close.columns();
let pane_to_close_height = pane_to_close.rows();
if let Some(panes) = self.panes_to_the_left_between_aligning_borders(id) {
if panes.iter().all(|p| {
let pane = self.panes.get(p).unwrap();
pane.can_increase_width_by(pane_to_close_width + 1)
}) {
for pane_id in panes.iter() {
self.increase_pane_width_right(&pane_id, pane_to_close_width + 1);
// 1 for the border
}
self.panes.remove(&id);
if self.active_terminal == Some(id) {
self.active_terminal = self.next_active_pane(panes);
}
return;
}
if self.active_terminal == Some(id) {
self.active_terminal = self.next_active_pane(terminals);
}
if let Some(panes) = self.panes_to_the_right_between_aligning_borders(id) {
if panes.iter().all(|p| {
let pane = self.panes.get(p).unwrap();
pane.can_increase_width_by(pane_to_close_width + 1)
}) {
for pane_id in panes.iter() {
self.increase_pane_width_left(&pane_id, pane_to_close_width + 1);
// 1 for the border
}
self.panes.remove(&id);
if self.active_terminal == Some(id) {
self.active_terminal = self.next_active_pane(panes);
}
return;
}
} else if let Some(terminals) = self.panes_below_between_aligning_borders(id) {
for terminal_id in terminals.iter() {
self.increase_pane_height_up(&terminal_id, terminal_to_close_height + 1);
// 1 for the border
}
if let Some(panes) = self.panes_above_between_aligning_borders(id) {
if panes.iter().all(|p| {
let pane = self.panes.get(p).unwrap();
pane.can_increase_height_by(pane_to_close_height + 1)
}) {
for pane_id in panes.iter() {
self.increase_pane_height_down(&pane_id, pane_to_close_height + 1);
// 1 for the border
}
self.panes.remove(&id);
if self.active_terminal == Some(id) {
self.active_terminal = self.next_active_pane(panes);
}
return;
}
if self.active_terminal == Some(id) {
self.active_terminal = self.next_active_pane(terminals);
}
if let Some(panes) = self.panes_below_between_aligning_borders(id) {
if panes.iter().all(|p| {
let pane = self.panes.get(p).unwrap();
pane.can_increase_height_by(pane_to_close_height + 1)
}) {
for pane_id in panes.iter() {
self.increase_pane_height_up(&pane_id, pane_to_close_height + 1);
// 1 for the border
}
self.panes.remove(&id);
if self.active_terminal == Some(id) {
self.active_terminal = self.next_active_pane(panes);
}
return;
}
} else {
}
// if we reached here, this is either the last pane or there's some sort of
// configuration error (eg. we're trying to close a pane surrounded by fixed panes)
self.panes.remove(&id);
if self.active_terminal.is_none() {
self.active_terminal = self.next_active_pane(self.get_pane_ids());
}
}
}
pub fn close_focused_pane(&mut self) {
Expand Down