Skip to content

Commit

Permalink
Simplified move_floating_pane_to_split
Browse files Browse the repository at this point in the history
  • Loading branch information
e82eric committed Oct 19, 2024
1 parent d14d094 commit 32b6ca3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
19 changes: 1 addition & 18 deletions mux/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1291,30 +1291,13 @@ impl Mux {

tab.set_floating_pane_visibility(false);

let active_non_floating_pane = tab.iter_panes_ignoring_zoom()
.iter()
.nth(tab.get_active_idx())
.map(|p| Arc::clone(&p.pane))
.ok_or_else(|| anyhow::anyhow!("tab does not have a active non floating pane"))?;

let pane_id = active_non_floating_pane.pane_id();

let pane_index = match tab
.iter_panes_ignoring_zoom()
.iter()
.find(|p| p.pane.pane_id() == pane_id)
{
Some(p) => p.index,
None => anyhow::bail!("invalid pane id {}", pane_id),
};

let split_request = SplitRequest {
direction,
target_is_second: true,
top_level: false,
size: Default::default(),
};
tab.split_and_insert(pane_index, split_request, Arc::clone(&floating_pane))?;
tab.split_and_insert(tab.get_active_idx(), split_request, Arc::clone(&floating_pane))?;

Ok(())
}
Expand Down
1 change: 0 additions & 1 deletion mux/src/tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,6 @@ impl TabInner {

self.active_floating_pane = root.active_floating_pane_index;
self.floating_pane_visible = root.floating_pane_visible;
//TODO: we are in a lock this should be safe? is it needed?
self.floating_panes.clear();
for pane_node in root.floating_panes {
if let PaneNode::Leaf(entry) = pane_node {
Expand Down

0 comments on commit 32b6ca3

Please sign in to comment.