And a few more todos

This commit is contained in:
Mikayla 2024-01-09 16:31:12 -08:00
parent 9ce7ef8949
commit e786e22121
No known key found for this signature in database
5 changed files with 14 additions and 18 deletions

View file

@ -71,6 +71,7 @@ async fn test_host_disconnect(
let workspace_b = let workspace_b =
cx_b.add_window(|cx| Workspace::new(0, project_b.clone(), client_b.app_state.clone(), cx)); cx_b.add_window(|cx| Workspace::new(0, project_b.clone(), client_b.app_state.clone(), cx));
let cx_b = &mut VisualTestContext::from_window(*workspace_b, cx_b); let cx_b = &mut VisualTestContext::from_window(*workspace_b, cx_b);
let workspace_b_view = workspace_b.root_view(cx_b).unwrap();
let editor_b = workspace_b let editor_b = workspace_b
.update(cx_b, |workspace, cx| { .update(cx_b, |workspace, cx| {
@ -85,8 +86,10 @@ async fn test_host_disconnect(
//TODO: focus //TODO: focus
assert!(cx_b.update_view(&editor_b, |editor, cx| editor.is_focused(cx))); assert!(cx_b.update_view(&editor_b, |editor, cx| editor.is_focused(cx)));
editor_b.update(cx_b, |editor, cx| editor.insert("X", cx)); editor_b.update(cx_b, |editor, cx| editor.insert("X", cx));
//todo(is_edited)
// assert!(workspace_b.is_edited(cx_b)); cx_b.update(|cx| {
assert!(workspace_b_view.read(cx).is_edited());
});
// Drop client A's connection. Collaborators should disappear and the project should not be shown as shared. // Drop client A's connection. Collaborators should disappear and the project should not be shown as shared.
server.forbid_connections(); server.forbid_connections();
@ -105,11 +108,11 @@ async fn test_host_disconnect(
// Ensure client B's edited state is reset and that the whole window is blurred. // Ensure client B's edited state is reset and that the whole window is blurred.
workspace_b workspace_b
.update(cx_b, |_, cx| { .update(cx_b, |workspace, cx| {
assert_eq!(cx.focused(), None); assert_eq!(cx.focused(), None);
assert!(!workspace.is_edited())
}) })
.unwrap(); .unwrap();
// assert!(!workspace_b.is_edited(cx_b));
// Ensure client B is not prompted to save edits when closing window after disconnecting. // Ensure client B is not prompted to save edits when closing window after disconnecting.
let can_close = workspace_b let can_close = workspace_b

View file

@ -282,8 +282,7 @@ impl Platform for TestPlatform {
} }
fn should_auto_hide_scrollbars(&self) -> bool { fn should_auto_hide_scrollbars(&self) -> bool {
// todo() false
true
} }
fn write_to_clipboard(&self, item: ClipboardItem) { fn write_to_clipboard(&self, item: ClipboardItem) {

View file

@ -18,7 +18,6 @@ use workspace::{ModalView, Toast, Workspace};
actions!(branches, [OpenRecent]); actions!(branches, [OpenRecent]);
pub fn init(cx: &mut AppContext) { pub fn init(cx: &mut AppContext) {
// todo!() po
cx.observe_new_views(|workspace: &mut Workspace, _| { cx.observe_new_views(|workspace: &mut Workspace, _| {
workspace.register_action(|workspace, action, cx| { workspace.register_action(|workspace, action, cx| {
BranchList::toggle_modal(workspace, action, cx).log_err(); BranchList::toggle_modal(workspace, action, cx).log_err();

View file

@ -12,7 +12,7 @@ use serde::Deserialize;
use std::sync::Arc; use std::sync::Arc;
use ui::{prelude::*, Button}; use ui::{prelude::*, Button};
const HANDLE_HITBOX_SIZE: f32 = 4.0; pub const HANDLE_HITBOX_SIZE: f32 = 4.0;
const HORIZONTAL_MIN_SIZE: f32 = 80.; const HORIZONTAL_MIN_SIZE: f32 = 80.;
const VERTICAL_MIN_SIZE: f32 = 100.; const VERTICAL_MIN_SIZE: f32 = 100.;
@ -268,15 +268,6 @@ impl Member {
) )
}) })
.into_any() .into_any()
// let el = div()
// .flex()
// .flex_1()
// .gap_px()
// .w_full()
// .h_full()
// .bg(cx.theme().colors().editor)
// .children();
} }
Member::Axis(axis) => axis Member::Axis(axis) => axis
.render( .render(

View file

@ -852,6 +852,10 @@ impl Workspace {
&self.right_dock &self.right_dock
} }
pub fn is_edited(&self) -> bool {
self.window_edited
}
pub fn add_panel<T: Panel>(&mut self, panel: View<T>, cx: &mut ViewContext<Self>) { pub fn add_panel<T: Panel>(&mut self, panel: View<T>, cx: &mut ViewContext<Self>) {
let dock = match panel.position(cx) { let dock = match panel.position(cx) {
DockPosition::Left => &self.left_dock, DockPosition::Left => &self.left_dock,
@ -2055,7 +2059,7 @@ impl Workspace {
_ => bounding_box.center(), _ => bounding_box.center(),
}; };
let distance_to_next = 8.; //todo(pane dividers styling) let distance_to_next = pane_group::HANDLE_HITBOX_SIZE;
let target = match direction { let target = match direction {
SplitDirection::Left => { SplitDirection::Left => {