Add focusable view and restore workspace deserialization. Partially restore split and tab functions

This commit is contained in:
Mikayla 2023-11-15 16:36:43 -08:00
parent e905ababcd
commit 78cea69172
No known key found for this signature in database
14 changed files with 173 additions and 110 deletions

View file

@ -1,7 +1,7 @@
use crate::{
AnyView, AnyWindowHandle, AppCell, AppContext, BackgroundExecutor, Context, ForegroundExecutor,
Model, ModelContext, Render, Result, Task, View, ViewContext, VisualContext, WindowContext,
WindowHandle,
AnyView, AnyWindowHandle, AppCell, AppContext, BackgroundExecutor, Context, FocusableView,
ForegroundExecutor, Model, ModelContext, Render, Result, Task, View, ViewContext,
VisualContext, WindowContext, WindowHandle,
};
use anyhow::{anyhow, Context as _};
use derive_more::{Deref, DerefMut};
@ -307,4 +307,13 @@ impl VisualContext for AsyncWindowContext {
self.window
.update(self, |_, cx| cx.replace_root_view(build_view))
}
fn focus_view<V>(&mut self, view: &View<V>) -> Self::Result<()>
where
V: FocusableView,
{
self.window.update(self, |_, cx| {
view.read(cx).focus_handle(cx).clone().focus(cx);
})
}
}