Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix image errors
Conrad Irwin6bfe6fa0e10b
diff --git a/crates/gpui2/src/elements/img.rs b/crates/gpui2/src/elements/img.rsindex 1080135fe16..5376c400122 100644--- a/crates/gpui2/src/elements/img.rs+++ b/crates/gpui2/src/elements/img.rs@@ -81,7 +81,7 @@ impl<V> Element<V> for Img<V> {if let Some(data) = image_future.clone().now_or_never()- .and_then(ResultExt::log_err)+ .and_then(|result| result.ok()){let corner_radii = corner_radii.to_pixels(bounds.size, cx.rem_size());cx.with_z_index(1, |cx| {@@ -90,7 +90,7 @@ impl<V> Element<V> for Img<V> {});} else {cx.spawn(|_, mut cx| async move {- if image_future.await.log_err().is_some() {+ if image_future.await.ok().is_some() {cx.on_next_frame(|cx| cx.notify());}})diff --git a/crates/gpui2/src/image_cache.rs b/crates/gpui2/src/image_cache.rsindex 6417f7d5e13..f80b0f0c2f7 100644--- a/crates/gpui2/src/image_cache.rs+++ b/crates/gpui2/src/image_cache.rs@@ -2,7 +2,7 @@ use crate::{ImageData, ImageId, SharedString};use collections::HashMap;use futures::{future::{BoxFuture, Shared},- AsyncReadExt, FutureExt,+ AsyncReadExt, FutureExt, TryFutureExt,};use image::ImageError;use parking_lot::Mutex;@@ -88,6 +88,14 @@ impl ImageCache {Ok(Arc::new(ImageData::new(image)))}}+ .map_err({+ let uri = uri.clone();++ move |error| {+ log::log!(log::Level::Error, "{:?} {:?}", &uri, &error);+ error+ }+ }).boxed().shared();diff --git a/crates/terminal_view2/src/terminal_view.rs b/crates/terminal_view2/src/terminal_view.rsindex 56de1ee7efe..27e55602fb8 100644--- a/crates/terminal_view2/src/terminal_view.rs+++ b/crates/terminal_view2/src/terminal_view.rs@@ -9,11 +9,10 @@ pub mod terminal_panel;// use crate::terminal_element::TerminalElement;use editor::{scroll::autoscroll::Autoscroll, Editor};use gpui::{- actions, div, img, red, Action, AnyElement, AppContext, Component, DispatchPhase, Div,- EventEmitter, FocusEvent, FocusHandle, Focusable, FocusableComponent, FocusableView,- InputHandler, InteractiveComponent, KeyDownEvent, Keystroke, Model, MouseButton,- ParentComponent, Pixels, Render, SharedString, Styled, Task, View, ViewContext, VisualContext,- WeakView,+ actions, div, Action, AnyElement, AppContext, Component, DispatchPhase, Div, EventEmitter,+ FocusEvent, FocusHandle, Focusable, FocusableComponent, FocusableView, InputHandler,+ InteractiveComponent, KeyDownEvent, Keystroke, Model, MouseButton, ParentComponent, Pixels,+ Render, SharedString, Styled, Task, View, ViewContext, VisualContext, WeakView,};use language::Bias;use persistence::TERMINAL_DB;@@ -32,7 +31,7 @@ use workspace::{notifications::NotifyResultExt,register_deserializable_item,searchable::{SearchEvent, SearchOptions, SearchableItem},- ui::{ContextMenu, Label, ListEntry},+ ui::{ContextMenu, Icon, IconElement, Label, ListEntry},CloseActiveItem, NewCenterTerminal, Pane, ToolbarItemLocation, Workspace, WorkspaceId,};@@ -755,7 +754,7 @@ impl Item for TerminalView {let title = self.terminal().read(cx).title();div()- .child(img().uri("icons/terminal.svg").bg(red()))+ .child(IconElement::new(Icon::Terminal)).child(title).render()}