Fix zoomed terminal pane issues on split (#21668)

Closes https://github.com/zed-industries/zed/issues/21652

* prevents zooming out the panel when any terminal pane is closed
* forces focus on new terminal panes, to prevent the workspace from
getting odd pane events in the background

Release Notes:

- (Preview only) Fixed zoomed terminal pane issues on split
This commit is contained in:
Kirill Bulatov 2024-12-07 10:39:01 +02:00 committed by GitHub
parent fa7dddd6b5
commit 14ba4a9c94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 87 additions and 28 deletions

View file

@ -306,6 +306,7 @@ pub struct Pane {
pub split_item_context_menu_handle: PopoverMenuHandle<ContextMenu>,
pinned_tab_count: usize,
diagnostics: HashMap<ProjectPath, DiagnosticSeverity>,
zoom_out_on_close: bool,
}
pub struct ActivationHistoryEntry {
@ -507,6 +508,7 @@ impl Pane {
new_item_context_menu_handle: Default::default(),
pinned_tab_count: 0,
diagnostics: Default::default(),
zoom_out_on_close: true,
}
}
@ -1586,7 +1588,7 @@ impl Pane {
.remove(&item.item_id());
}
if self.items.is_empty() && close_pane_if_empty && self.zoomed {
if self.zoom_out_on_close && self.items.is_empty() && close_pane_if_empty && self.zoomed {
cx.emit(Event::ZoomOut);
}
@ -2787,6 +2789,10 @@ impl Pane {
pub fn drag_split_direction(&self) -> Option<SplitDirection> {
self.drag_split_direction
}
pub fn set_zoom_out_on_close(&mut self, zoom_out_on_close: bool) {
self.zoom_out_on_close = zoom_out_on_close;
}
}
impl FocusableView for Pane {