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.

Merge remote-tracking branch 'origin/main' into cache

Antonio Scandurra94293b3bf92f
diff --cc crates/gpui/src/text_system.rs
index 7c5adef12d7,d80c9163a99..0495f54253d
--- a/crates/gpui/src/text_system.rs
+++ b/crates/gpui/src/text_system.rs
@@@ -364,17 -363,13 +367,13 @@@ impl TextSystem
Ok(lines)
}
- pub fn start_frame(&self) {
- self.line_layout_cache.start_frame()
+ pub fn finish_frame(&self, reused_views: &FxHashSet<EntityId>) {
+ self.line_layout_cache.finish_frame(reused_views)
}
- pub fn line_wrapper(
- self: &Arc<Self>,
- font: Font,
- font_size: Pixels,
- ) -> Result<LineWrapperHandle> {
+ pub fn line_wrapper(self: &Arc<Self>, font: Font, font_size: Pixels) -> LineWrapperHandle {
let lock = &mut self.wrapper_pool.lock();
- let font_id = self.font_id(&font)?;
+ let font_id = self.resolve_font(&font);
let wrappers = lock
.entry(FontIdWithSize { font_id, font_size })
.or_default();
diff --cc crates/gpui/src/window.rs
index c11f12d8918,509a6d84666..f3434289966
--- a/crates/gpui/src/window.rs
+++ b/crates/gpui/src/window.rs
@@@ -1530,31 -1429,6 +1530,28 @@@ impl<'a> WindowContext<'a>
self.platform.set_cursor_style(cursor_style);
}
+ // Register requested input handler with the platform window.
+ if let Some(requested_input) = self.window.next_frame.requested_input_handler.as_mut() {
+ if let Some(handler) = requested_input.handler.take() {
+ self.window.platform_window.set_input_handler(handler);
+ }
+ }
+
+ self.window.layout_engine.as_mut().unwrap().clear();
+ self.text_system()
+ .finish_frame(&self.window.next_frame.reused_views);
+ self.window
+ .next_frame
+ .finish(&mut self.window.rendered_frame);
+ ELEMENT_ARENA.with_borrow_mut(|element_arena| element_arena.clear());
+
- self.window.refreshing = false;
- self.window.drawing = false;
-
+ let previous_focus_path = self.window.rendered_frame.focus_path();
+ let previous_window_active = self.window.rendered_frame.window_active;
+ mem::swap(&mut self.window.rendered_frame, &mut self.window.next_frame);
+ self.window.next_frame.clear();
+ let current_focus_path = self.window.rendered_frame.focus_path();
+ let current_window_active = self.window.rendered_frame.window_active;
+
if previous_focus_path != current_focus_path
|| previous_window_active != current_window_active
{
@@@ -1583,9 -1457,10 +1580,11 @@@
.retain(&(), |listener| listener(&event, self));
}
+ self.window
+ .platform_window
+ .draw(&self.window.rendered_frame.scene);
++ self.window.refreshing = false;
+ self.window.drawing = false;
- ELEMENT_ARENA.with_borrow_mut(|element_arena| element_arena.clear());
-
- scene
}
/// Dispatch a mouse or keyboard event on the window.