Merge pull request #2456 from zed-industries/fix-dock-pane-focus

Make dock not eagerly steal focus from sub items
This commit is contained in:
Mikayla Maki 2023-05-09 15:59:06 -04:00 committed by GitHub
commit 26d80eef0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 4 deletions

View File

@ -3963,6 +3963,15 @@ impl Drop for AnyViewHandle {
}
}
impl Debug for AnyViewHandle {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("AnyViewHandle")
.field("window_id", &self.window_id)
.field("view_id", &self.view_id)
.finish()
}
}
pub struct AnyModelHandle {
model_id: usize,
model_type: TypeId,
@ -4072,12 +4081,20 @@ impl AnyWeakModelHandle {
}
}
#[derive(Debug, Copy)]
#[derive(Copy)]
pub struct WeakViewHandle<T> {
any_handle: AnyWeakViewHandle,
view_type: PhantomData<T>,
}
impl<T> Debug for WeakViewHandle<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct(&format!("WeakViewHandle<{}>", type_name::<T>()))
.field("any_handle", &self.any_handle)
.finish()
}
}
impl<T> WeakHandle for WeakViewHandle<T> {
fn id(&self) -> usize {
self.view_id

View File

@ -197,7 +197,7 @@ impl SerializedPane {
let pane_handle = pane_handle
.upgrade(cx)
.ok_or_else(|| anyhow!("pane was dropped"))?;
Pane::add_item(workspace, &pane_handle, item_handle, false, false, None, cx);
Pane::add_item(workspace, &pane_handle, item_handle, true, true, None, cx);
anyhow::Ok(())
})??;
}

View File

@ -1601,7 +1601,7 @@ impl Workspace {
self.active_item_path_changed(cx);
if &pane == self.dock_pane() {
Dock::show(self, true, cx);
Dock::show(self, false, cx);
} else {
self.last_active_center_pane = Some(pane.downgrade());
if self.dock.is_anchored_at(DockAnchor::Expanded) {
@ -2609,7 +2609,7 @@ impl Workspace {
Dock::set_dock_position(
workspace,
serialized_workspace.dock_position,
true,
false,
cx,
);
});