Fix dock panels not focusing their contents on toggle
Co-authored-by: Antonio <antonio@zed.dev>
This commit is contained in:
parent
a9f817fc14
commit
137104e00e
3 changed files with 13 additions and 14 deletions
|
@ -346,6 +346,7 @@ impl Dock {
|
|||
})
|
||||
.ok();
|
||||
}
|
||||
// todo!() we do not use this event in the production code (even in zed1), remove it
|
||||
PanelEvent::Activate => {
|
||||
if let Some(ix) = this
|
||||
.panel_entries
|
||||
|
|
|
@ -10,7 +10,7 @@ use gpui::{
|
|||
actions, impl_actions, overlay, prelude::*, rems, Action, AnchorCorner, AnyWeakView,
|
||||
AppContext, AsyncWindowContext, DismissEvent, Div, EntityId, EventEmitter, FocusHandle,
|
||||
Focusable, FocusableView, Model, MouseButton, NavigationDirection, Pixels, Point, PromptLevel,
|
||||
Render, Task, View, ViewContext, VisualContext, WeakView, WindowContext,
|
||||
Render, Subscription, Task, View, ViewContext, VisualContext, WeakView, WindowContext,
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
use project::{Project, ProjectEntryId, ProjectPath};
|
||||
|
@ -174,6 +174,7 @@ pub struct Pane {
|
|||
// can_drop: Rc<dyn Fn(&DragAndDrop<Workspace>, &WindowContext) -> bool>,
|
||||
can_split: bool,
|
||||
// render_tab_bar_buttons: Rc<dyn Fn(&mut Pane, &mut ViewContext<Pane>) -> AnyElement<Pane>>,
|
||||
subscriptions: Vec<Subscription>,
|
||||
}
|
||||
|
||||
pub struct ItemNavHistory {
|
||||
|
@ -312,10 +313,17 @@ impl Pane {
|
|||
// context_menu.update(cx, |menu, _| {
|
||||
// menu.set_position_mode(OverlayPositionMode::Local)
|
||||
// });
|
||||
//
|
||||
let focus_handle = cx.focus_handle();
|
||||
|
||||
let subscriptions = vec![
|
||||
cx.on_focus_in(&focus_handle, move |this, cx| this.focus_in(cx)),
|
||||
cx.on_focus_out(&focus_handle, move |this, cx| this.focus_out(cx)),
|
||||
];
|
||||
|
||||
let handle = cx.view().downgrade();
|
||||
Self {
|
||||
focus_handle: cx.focus_handle(),
|
||||
focus_handle,
|
||||
items: Vec::new(),
|
||||
activation_history: Vec::new(),
|
||||
was_focused: false,
|
||||
|
@ -402,6 +410,7 @@ impl Pane {
|
|||
// })
|
||||
// .into_any()
|
||||
// }),
|
||||
subscriptions,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2062,18 +2071,6 @@ impl Render for Pane {
|
|||
.track_focus(&self.focus_handle)
|
||||
.size_full()
|
||||
.overflow_hidden()
|
||||
.on_focus_in({
|
||||
let this = this.clone();
|
||||
move |event, cx| {
|
||||
this.update(cx, |this, cx| this.focus_in(cx)).ok();
|
||||
}
|
||||
})
|
||||
.on_focus_out({
|
||||
let this = this.clone();
|
||||
move |event, cx| {
|
||||
this.update(cx, |this, cx| this.focus_out(cx)).ok();
|
||||
}
|
||||
})
|
||||
.on_action(cx.listener(|pane, _: &SplitLeft, cx| pane.split(SplitDirection::Left, cx)))
|
||||
.on_action(cx.listener(|pane, _: &SplitUp, cx| pane.split(SplitDirection::Up, cx)))
|
||||
.on_action(
|
||||
|
|
|
@ -1633,6 +1633,7 @@ impl Workspace {
|
|||
panel.focus_handle(cx).focus(cx);
|
||||
reveal_dock = true;
|
||||
} else {
|
||||
// todo!()
|
||||
// if panel.is_zoomed(cx) {
|
||||
// dock.set_open(false, cx);
|
||||
// }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue