Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Checkpoint
Nathan Sobo0a2a5be71c5b
diff --git a/Cargo.lock b/Cargo.lockindex 16ff87f3dac..599bfd5a2ed 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -974,7 +974,7 @@ dependencies = ["collections","editor","gpui",- "itertools",+ "itertools 0.10.5","language","outline","project",@@ -1924,7 +1924,7 @@ dependencies = ["cranelift-codegen","cranelift-entity","cranelift-frontend",- "itertools",+ "itertools 0.10.5","log","smallvec","wasmparser",@@ -2345,7 +2345,7 @@ dependencies = ["git","gpui","indoc",- "itertools",+ "itertools 0.10.5","language","lazy_static","log",@@ -3135,7 +3135,7 @@ dependencies = ["futures 0.3.28","gpui_macros","image",- "itertools",+ "itertools 0.10.5","lazy_static","log","media",@@ -3749,6 +3749,15 @@ dependencies = ["either",]+[[package]]+name = "itertools"+version = "0.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"+dependencies = [+ "either",+]+[[package]]name = "itoa"version = "1.0.9"@@ -5478,7 +5487,7 @@ dependencies = ["globset","gpui","ignore",- "itertools",+ "itertools 0.10.5","language","lazy_static","log",@@ -5602,7 +5611,7 @@ checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5"dependencies = ["bytes 1.4.0","heck 0.3.3",- "itertools",+ "itertools 0.10.5","lazy_static","log","multimap",@@ -5621,7 +5630,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba"dependencies = ["anyhow",- "itertools",+ "itertools 0.10.5","proc-macro2","quote","syn 1.0.109",@@ -5634,7 +5643,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe"dependencies = ["anyhow",- "itertools",+ "itertools 0.10.5","proc-macro2","quote","syn 1.0.109",@@ -7252,7 +7261,7 @@ version = "0.2.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "0c12bc9199d1db8234678b7051747c07f517cdcf019262d1847b94ec8b1aee3e"dependencies = [- "itertools",+ "itertools 0.10.5","nom","unicode_categories",]@@ -7378,6 +7387,7 @@ dependencies = ["anyhow","derive_more","gpui2",+ "itertools 0.11.0","log","refineable","rust-embed",@@ -7656,7 +7666,7 @@ dependencies = ["dirs 4.0.0","futures 0.3.28","gpui",- "itertools",+ "itertools 0.10.5","lazy_static","libc","mio-extras",@@ -7687,7 +7697,7 @@ dependencies = ["editor","futures 0.3.28","gpui",- "itertools",+ "itertools 0.10.5","language","lazy_static","libc",@@ -8863,7 +8873,7 @@ dependencies = ["futures 0.3.28","gpui","indoc",- "itertools",+ "itertools 0.10.5","language","language_selector","log",@@ -9696,7 +9706,7 @@ dependencies = ["gpui","indoc","install_cli",- "itertools",+ "itertools 0.10.5","language","lazy_static","log",diff --git a/crates/storybook/Cargo.toml b/crates/storybook/Cargo.tomlindex 32b0b989e39..69801a94863 100644--- a/crates/storybook/Cargo.toml+++ b/crates/storybook/Cargo.toml@@ -12,6 +12,7 @@ path = "src/storybook.rs"anyhow.workspace = truederive_more.workspace = truegpui2 = { path = "../gpui2" }+itertools = "0.11.0"log.workspace = truerefineable = { path = "../refineable" }rust-embed.workspace = truediff --git a/crates/storybook/src/gpui3/mod.rs b/crates/storybook/src/gpui3/mod.rsindex 9f32b8abf38..b17f45e6173 100644--- a/crates/storybook/src/gpui3/mod.rs+++ b/crates/storybook/src/gpui3/mod.rs@@ -3,26 +3,28 @@ mod color;mod element;mod elements;mod geometry;+mod ordered;+mod scene;mod style;mod taffy;mod window;+use self::editor::Editor;use anyhow::Result;-pub use gpui2::ArcCow;-use gpui2::Reference;-pub use app::*;pub use color::*;pub use element::*;pub use elements::*;pub use geometry::*;+pub use gpui2::ArcCow;+use gpui2::Reference;+use ordered::*;+pub use scene::*;pub use style::*;pub use taffy::LayoutId;use taffy::TaffyLayoutEngine;pub use window::*;-use self::editor::Editor;-pub trait Context {type EntityContext<'a, 'w, T: 'static>;diff --git a/crates/storybook/src/gpui3/ordered.rs b/crates/storybook/src/gpui3/ordered.rsnew file mode 100644index 00000000000..934a8d1c633--- /dev/null+++ b/crates/storybook/src/gpui3/ordered.rs@@ -0,0 +1,24 @@+pub struct Ordered<P> {+ pub order: u32,+ pub primitive: P,+}++impl<P> Ord for Ordered<P> {+ fn cmp(&self, other: &Self) -> std::cmp::Ordering {+ self.order.cmp(&other.order)+ }+}++impl<P> PartialOrd for Ordered<P> {+ fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {+ Some(self.cmp(other))+ }+}++impl<P> Eq for Ordered<P> {}++impl<P> PartialEq for Ordered<P> {+ fn eq(&self, other: &Self) -> bool {+ self.order == other.order+ }+}diff --git a/crates/storybook/src/gpui3/scene.rs b/crates/storybook/src/gpui3/scene.rsnew file mode 100644index 00000000000..50184ef03b7--- /dev/null+++ b/crates/storybook/src/gpui3/scene.rs@@ -0,0 +1,45 @@+use super::Ordered;++/// A platform neutral representation of all geometry to be drawn for the current frame.+pub struct Scene {+ quads: Vec<Ordered<Quad>>,+ glyphs: Vec<Ordered<Glyph>>,+}++impl Scene {+ pub fn new() -> Self {+ Scene {+ quads: Vec::new(),+ glyphs: Vec::new(),+ }+ }++ pub fn add(&mut self, order: u32, primitive: impl Into<Primitive>) {+ match primitive.into() {+ Primitive::Quad(primitive) => self.quads.push(Ordered { order, primitive }),+ Primitive::Glyph(primitive) => self.glyphs.push(Ordered { order, primitive }),+ }+ }++ pub fn draw(&mut self) {+ self.quads.sort_unstable();+ self.glyphs.sort_unstable();+ }+}++pub enum Primitive {+ Quad(Quad),+ Glyph(Glyph),+ // Icon(Icon),+ // Image(Image),+ // Shadow(Shadow),+ // Curve(Curve),+}++#[derive(Eq, Ord, PartialEq, PartialOrd)]+pub struct Quad {}+pub struct Glyph {}+// pub struct Icon {}+// pub struct Image {}+// pub struct Shadow {}+// pub struct Curve {}