Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Redraw when toggling between windows (#9236)

Thorsten Ball3c28282108ca
diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rs
index 60cab841255..23b01c94628 100644
--- a/crates/gpui/src/window.rs
+++ b/crates/gpui/src/window.rs
@@ -468,6 +468,7 @@ impl Window {
.activation_observers
.clone()
.retain(&(), |callback| callback(cx));
+ cx.refresh();
})
.log_err();
}
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs
index 8198cab533f..45e98e4430b 100644
--- a/crates/workspace/src/workspace.rs
+++ b/crates/workspace/src/workspace.rs
@@ -5207,6 +5207,11 @@ mod tests {
cx.deactivate_window();
item.update(cx, |item, _| assert_eq!(item.save_count, 1));
+ // Re-activating the window doesn't save the file.
+ cx.update(|cx| cx.activate_window());
+ cx.executor().run_until_parked();
+ item.update(cx, |item, _| assert_eq!(item.save_count, 1));
+
// Autosave on focus change.
item.update(cx, |item, cx| {
cx.focus_self();
@@ -5224,13 +5229,11 @@ mod tests {
item.update(cx, |item, _| assert_eq!(item.save_count, 2));
// Deactivating the window still saves the file.
- cx.update(|cx| cx.activate_window());
item.update(cx, |item, cx| {
cx.focus_self();
item.is_dirty = true;
});
cx.deactivate_window();
-
item.update(cx, |item, _| assert_eq!(item.save_count, 3));
// Autosave after delay.