diff --git a/Cargo.lock b/Cargo.lock index 2e572f8bf3..0e19fef345 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2618,8 +2618,6 @@ dependencies = [ [[package]] name = "calloop" version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb9f6e1368bd4621d2c86baa7e37de77a938adf5221e5dd3d6133340101b309e" dependencies = [ "bitflags 2.9.4", "polling", @@ -10029,6 +10027,7 @@ name = "miniprofiler_ui" version = "0.1.0" dependencies = [ "gpui", + "log", "serde_json", "smol", "util", diff --git a/Cargo.toml b/Cargo.toml index 3ab1780ef1..ece6cd56af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -784,7 +784,7 @@ features = [ notify = { git = "https://github.com/zed-industries/notify.git", rev = "b4588b2e5aee68f4c0e100f140e808cbce7b1419" } notify-types = { git = "https://github.com/zed-industries/notify.git", rev = "b4588b2e5aee68f4c0e100f140e808cbce7b1419" } windows-capture = { git = "https://github.com/zed-industries/windows-capture.git", rev = "f0d6c1b6691db75461b732f6d5ff56eed002eeb9" } -# calloop = { path = "/home/davidsk/tmp/calloop" } +calloop = { path = "/home/davidsk/tmp/calloop" } [profile.dev] split-debuginfo = "unpacked" diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs index aeb611225b..0a0168c8eb 100644 --- a/crates/git_ui/src/project_diff.rs +++ b/crates/git_ui/src/project_diff.rs @@ -553,7 +553,56 @@ impl ProjectDiff { } } - pub async fn new_refresh(this: WeakEntity, cx: &mut AsyncWindowContext) -> Result<()> { + pub async fn old_refresh(this: WeakEntity, cx: &mut AsyncWindowContext) -> Result<()> { + let mut path_keys = Vec::new(); + let buffers_to_load = this.update(cx, |this, cx| { + let (repo, buffers_to_load) = this.branch_diff.update(cx, |branch_diff, cx| { + let load_buffers = branch_diff.load_buffers(cx); + (branch_diff.repo().cloned(), load_buffers) + }); + let mut previous_paths = this.multibuffer.read(cx).paths().collect::>(); + + if let Some(repo) = repo { + let repo = repo.read(cx); + + path_keys = Vec::with_capacity(buffers_to_load.len()); + for entry in buffers_to_load.iter() { + let sort_prefix = sort_prefix(&repo, &entry.repo_path, entry.file_status, cx); + let path_key = + PathKey::with_sort_prefix(sort_prefix, entry.repo_path.as_ref().clone()); + previous_paths.remove(&path_key); + path_keys.push(path_key) + } + } + + this.multibuffer.update(cx, |multibuffer, cx| { + for path in previous_paths { + this.buffer_diff_subscriptions.remove(&path.path); + multibuffer.remove_excerpts_for_path(path, cx); + } + }); + buffers_to_load + })?; + + for (entry, path_key) in buffers_to_load.into_iter().zip(path_keys.into_iter()) { + if let Some((buffer, diff)) = entry.load.await.log_err() { + cx.update(|window, cx| { + this.update(cx, |this, cx| { + this.register_buffer(path_key, entry.file_status, buffer, diff, window, cx) + }) + .ok(); + })?; + } + } + this.update(cx, |this, cx| { + this.pending_scroll.take(); + cx.notify(); + })?; + + Ok(()) + } + + pub async fn refresh(this: WeakEntity, cx: &mut AsyncWindowContext) -> Result<()> { use git_store::branch_diff::BranchDiff; let Some(this) = this.upgrade() else { return Ok(()); @@ -632,56 +681,7 @@ impl ProjectDiff { })?; Ok(()) - } - - pub async fn refresh(this: WeakEntity, cx: &mut AsyncWindowContext) -> Result<()> { - let mut path_keys = Vec::new(); - let buffers_to_load = this.update(cx, |this, cx| { - let (repo, buffers_to_load) = this.branch_diff.update(cx, |branch_diff, cx| { - let load_buffers = branch_diff.load_buffers(cx); - (branch_diff.repo().cloned(), load_buffers) - }); - let mut previous_paths = this.multibuffer.read(cx).paths().collect::>(); - - if let Some(repo) = repo { - let repo = repo.read(cx); - - path_keys = Vec::with_capacity(buffers_to_load.len()); - for entry in buffers_to_load.iter() { - let sort_prefix = sort_prefix(&repo, &entry.repo_path, entry.file_status, cx); - let path_key = - PathKey::with_sort_prefix(sort_prefix, entry.repo_path.as_ref().clone()); - previous_paths.remove(&path_key); - path_keys.push(path_key) - } - } - - this.multibuffer.update(cx, |multibuffer, cx| { - for path in previous_paths { - this.buffer_diff_subscriptions.remove(&path.path); - multibuffer.remove_excerpts_for_path(path, cx); - } - }); - buffers_to_load - })?; - - for (entry, path_key) in buffers_to_load.into_iter().zip(path_keys.into_iter()) { - if let Some((buffer, diff)) = entry.load.await.log_err() { - cx.update(|window, cx| { - this.update(cx, |this, cx| { - this.register_buffer(path_key, entry.file_status, buffer, diff, window, cx) - }) - .ok(); - })?; - } - } - this.update(cx, |this, cx| { - this.pending_scroll.take(); - cx.notify(); - })?; - - Ok(()) - } + } #[cfg(any(test, feature = "test-support"))] pub fn excerpt_paths(&self, cx: &App) -> Vec> { diff --git a/crates/gpui/src/platform/linux/wayland/window.rs b/crates/gpui/src/platform/linux/wayland/window.rs index 95276a51d5..c02d1f3bc3 100644 --- a/crates/gpui/src/platform/linux/wayland/window.rs +++ b/crates/gpui/src/platform/linux/wayland/window.rs @@ -902,12 +902,9 @@ impl WaylandWindowStatePtr { pub fn handle_input(&self, input: PlatformInput) { if let Some(ref mut fun) = self.callbacks.borrow_mut().input - // && !fun(input.clone()).propagate + && !fun(input.clone()).propagate { - let res = fun(input.clone()); - if res.propagate { - return; - } + return; } if let PlatformInput::KeyDown(event) = input && event.keystroke.modifiers.is_subset_of(&Modifiers::shift()) diff --git a/crates/miniprofiler_ui/Cargo.toml b/crates/miniprofiler_ui/Cargo.toml index bb508a188e..2fb0d26b68 100644 --- a/crates/miniprofiler_ui/Cargo.toml +++ b/crates/miniprofiler_ui/Cargo.toml @@ -18,6 +18,7 @@ workspace.workspace = true util.workspace = true serde_json.workspace = true smol.workspace = true +log.workspace = true [dev-dependencies] gpui = { workspace = true, features = ["test-support"] } diff --git a/crates/miniprofiler_ui/src/miniprofiler_ui.rs b/crates/miniprofiler_ui/src/miniprofiler_ui.rs index b3dab02058..d5b526f586 100644 --- a/crates/miniprofiler_ui/src/miniprofiler_ui.rs +++ b/crates/miniprofiler_ui/src/miniprofiler_ui.rs @@ -305,12 +305,17 @@ impl Render for ProfilerWindow { ); cx.background_spawn(async move { - let path = path.await; - let path = - path.log_err().and_then(|p| p.log_err()).flatten(); - - let Some(path) = path else { - return; + let path = match path.await.log_err() { + Some(Ok(Some(path))) => path, + Some(e @ Err(_)) => { + e.log_err(); + log::warn!("Saving miniprof in workingdir"); + std::path::Path::new( + "performance_profile.miniprof", + ) + .to_path_buf() + } + Some(Ok(None)) | None => return, }; let Some(timings) =