From d6d5cf0294b1231f4909a782e90b491cc6838fae Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 10 Nov 2020 02:32:57 +0100 Subject: Restore hotkeys in `pane_grid` example - Implement `subscription::events_with` - Remove `pane_grid::KeyPressEvent` - Return closest sibling in `pane_grid::State::close` --- native/src/widget/pane_grid/state.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'native/src/widget/pane_grid') diff --git a/native/src/widget/pane_grid/state.rs b/native/src/widget/pane_grid/state.rs index e2793641..be36b070 100644 --- a/native/src/widget/pane_grid/state.rs +++ b/native/src/widget/pane_grid/state.rs @@ -227,12 +227,13 @@ impl State { let _ = self.internal.layout.resize(split, ratio); } - /// Closes the given [`Pane`] and returns its internal state, if it exists. + /// Closes the given [`Pane`] and returns its internal state and its closest + /// sibling, if it exists. /// /// [`Pane`]: struct.Pane.html - pub fn close(&mut self, pane: &Pane) -> Option { - if let Some(_) = self.internal.layout.remove(pane) { - self.panes.remove(pane) + pub fn close(&mut self, pane: &Pane) -> Option<(T, Pane)> { + if let Some(sibling) = self.internal.layout.remove(pane) { + self.panes.remove(pane).map(|state| (state, sibling)) } else { None } -- cgit