commit
a6d6f8a193
3 changed files with 17 additions and 10 deletions
|
@ -81,7 +81,7 @@ impl<V> Element<V> for Img<V> {
|
||||||
if let Some(data) = image_future
|
if let Some(data) = image_future
|
||||||
.clone()
|
.clone()
|
||||||
.now_or_never()
|
.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());
|
let corner_radii = corner_radii.to_pixels(bounds.size, cx.rem_size());
|
||||||
cx.with_z_index(1, |cx| {
|
cx.with_z_index(1, |cx| {
|
||||||
|
@ -90,7 +90,7 @@ impl<V> Element<V> for Img<V> {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
cx.spawn(|_, mut cx| async move {
|
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());
|
cx.on_next_frame(|cx| cx.notify());
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::{ImageData, ImageId, SharedString};
|
||||||
use collections::HashMap;
|
use collections::HashMap;
|
||||||
use futures::{
|
use futures::{
|
||||||
future::{BoxFuture, Shared},
|
future::{BoxFuture, Shared},
|
||||||
AsyncReadExt, FutureExt,
|
AsyncReadExt, FutureExt, TryFutureExt,
|
||||||
};
|
};
|
||||||
use image::ImageError;
|
use image::ImageError;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
@ -88,6 +88,14 @@ impl ImageCache {
|
||||||
Ok(Arc::new(ImageData::new(image)))
|
Ok(Arc::new(ImageData::new(image)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.map_err({
|
||||||
|
let uri = uri.clone();
|
||||||
|
|
||||||
|
move |error| {
|
||||||
|
log::log!(log::Level::Error, "{:?} {:?}", &uri, &error);
|
||||||
|
error
|
||||||
|
}
|
||||||
|
})
|
||||||
.boxed()
|
.boxed()
|
||||||
.shared();
|
.shared();
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,10 @@ pub mod terminal_panel;
|
||||||
// use crate::terminal_element::TerminalElement;
|
// use crate::terminal_element::TerminalElement;
|
||||||
use editor::{scroll::autoscroll::Autoscroll, Editor};
|
use editor::{scroll::autoscroll::Autoscroll, Editor};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions, div, img, red, Action, AnyElement, AppContext, Component, DispatchPhase, Div,
|
actions, div, Action, AnyElement, AppContext, Component, DispatchPhase, Div, EventEmitter,
|
||||||
EventEmitter, FocusEvent, FocusHandle, Focusable, FocusableComponent, FocusableView,
|
FocusEvent, FocusHandle, Focusable, FocusableComponent, FocusableView, InputHandler,
|
||||||
InputHandler, InteractiveComponent, KeyDownEvent, Keystroke, Model, MouseButton,
|
InteractiveComponent, KeyDownEvent, Keystroke, Model, MouseButton, ParentComponent, Pixels,
|
||||||
ParentComponent, Pixels, Render, SharedString, Styled, Task, View, ViewContext, VisualContext,
|
Render, SharedString, Styled, Task, View, ViewContext, VisualContext, WeakView,
|
||||||
WeakView,
|
|
||||||
};
|
};
|
||||||
use language::Bias;
|
use language::Bias;
|
||||||
use persistence::TERMINAL_DB;
|
use persistence::TERMINAL_DB;
|
||||||
|
@ -32,7 +31,7 @@ use workspace::{
|
||||||
notifications::NotifyResultExt,
|
notifications::NotifyResultExt,
|
||||||
register_deserializable_item,
|
register_deserializable_item,
|
||||||
searchable::{SearchEvent, SearchOptions, SearchableItem},
|
searchable::{SearchEvent, SearchOptions, SearchableItem},
|
||||||
ui::{ContextMenu, Label, ListEntry},
|
ui::{ContextMenu, Icon, IconElement, Label, ListEntry},
|
||||||
CloseActiveItem, NewCenterTerminal, Pane, ToolbarItemLocation, Workspace, WorkspaceId,
|
CloseActiveItem, NewCenterTerminal, Pane, ToolbarItemLocation, Workspace, WorkspaceId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -755,7 +754,7 @@ impl Item for TerminalView {
|
||||||
let title = self.terminal().read(cx).title();
|
let title = self.terminal().read(cx).title();
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.child(img().uri("icons/terminal.svg").bg(red()))
|
.child(IconElement::new(Icon::Terminal))
|
||||||
.child(title)
|
.child(title)
|
||||||
.render()
|
.render()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue