Reuse PaneGrid::focus to remove some duplication
This commit is contained in:
parent
2459648574
commit
460565056e
1 changed files with 2 additions and 9 deletions
|
|
@ -449,10 +449,7 @@ impl<T> State<T> {
|
||||||
node.split(kind, new_pane);
|
node.split(kind, new_pane);
|
||||||
|
|
||||||
let _ = self.panes.insert(new_pane, state);
|
let _ = self.panes.insert(new_pane, state);
|
||||||
self.internal.focused_pane = FocusedPane::Some {
|
self.focus(&new_pane);
|
||||||
pane: new_pane,
|
|
||||||
focus: Focus::Idle,
|
|
||||||
};
|
|
||||||
|
|
||||||
Some(new_pane)
|
Some(new_pane)
|
||||||
}
|
}
|
||||||
|
|
@ -472,11 +469,7 @@ impl<T> State<T> {
|
||||||
|
|
||||||
pub fn close(&mut self, pane: &Pane) -> Option<T> {
|
pub fn close(&mut self, pane: &Pane) -> Option<T> {
|
||||||
if let Some(sibling) = self.internal.layout.remove(pane) {
|
if let Some(sibling) = self.internal.layout.remove(pane) {
|
||||||
self.internal.focused_pane = FocusedPane::Some {
|
self.focus(&sibling);
|
||||||
pane: sibling,
|
|
||||||
focus: Focus::Idle,
|
|
||||||
};
|
|
||||||
|
|
||||||
self.panes.remove(pane)
|
self.panes.remove(pane)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue