Merge branch 'main' into fix-nondeterministic-terminal-test

This commit is contained in:
Mikayla Maki 2023-04-22 11:17:06 +12:00 committed by GitHub
commit 8e0d359c63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
93 changed files with 1599 additions and 1892 deletions

View file

@ -3,7 +3,7 @@ use gpui::{
elements::*,
impl_internal_actions,
platform::{CursorStyle, MouseButton},
AppContext, Drawable, Element, Entity, View, ViewContext, ViewHandle, WeakModelHandle,
AnyElement, AppContext, Element, Entity, View, ViewContext, ViewHandle, WeakModelHandle,
WeakViewHandle,
};
use settings::Settings;
@ -42,11 +42,11 @@ impl View for TerminalButton {
"TerminalButton"
}
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
let workspace = self.workspace.upgrade(cx);
let project = match workspace {
Some(workspace) => workspace.read(cx).project().read(cx),
None => return Empty::new().boxed(),
None => return Empty::new().into_any(),
};
let focused_view = cx.focused_view_id();
@ -79,20 +79,18 @@ impl View for TerminalButton {
.constrained()
.with_width(style.icon_size)
.aligned()
.named("terminals-icon"),
.into_any_named("terminals-icon"),
)
.with_children(has_terminals.then(|| {
Label::new(terminal_count.to_string(), style.label.text.clone())
.contained()
.with_style(style.label.container)
.aligned()
.boxed()
}))
.constrained()
.with_height(style.icon_size)
.contained()
.with_style(style.container)
.boxed()
}
})
.with_cursor_style(CursorStyle::PointingHand)
@ -111,17 +109,10 @@ impl View for TerminalButton {
Some(Box::new(FocusDock)),
theme.tooltip.clone(),
cx,
)
.boxed(),
),
)
.with_child(
ChildView::new(&self.popup_menu, cx)
.aligned()
.top()
.right()
.boxed(),
)
.boxed()
.with_child(ChildView::new(&self.popup_menu, cx).aligned().top().right())
.into_any_named("terminal button")
}
}

View file

@ -10,7 +10,7 @@ use gpui::{
platform::{CursorStyle, MouseButton},
serde_json::json,
text_layout::{Line, RunStyle},
Drawable, Element, EventContext, FontCache, ModelContext, MouseRegion, Quad, SceneBuilder,
AnyElement, Element, EventContext, FontCache, ModelContext, MouseRegion, Quad, SceneBuilder,
SizeConstraint, TextLayoutCache, ViewContext, WeakModelHandle,
};
use itertools::Itertools;
@ -45,7 +45,7 @@ pub struct LayoutState {
size: TerminalSize,
mode: TermMode,
display_offset: usize,
hyperlink_tooltip: Option<Element<TerminalView>>,
hyperlink_tooltip: Option<AnyElement<TerminalView>>,
gutter: f32,
}
@ -552,7 +552,7 @@ impl TerminalElement {
}
}
impl Drawable<TerminalView> for TerminalElement {
impl Element<TerminalView> for TerminalElement {
type LayoutState = LayoutState;
type PaintState = ();
@ -605,11 +605,10 @@ impl Drawable<TerminalView> for TerminalElement {
.constrained()
.with_width(dimensions.width())
.with_height(dimensions.height())
.with_tooltip::<TerminalElement>(id, uri, None, tooltip_style, cx)
.boxed(),
.with_tooltip::<TerminalElement>(id, uri, None, tooltip_style, cx),
)
.with_position_mode(gpui::elements::OverlayPositionMode::Local)
.boxed();
.into_any();
tooltip.layout(
SizeConstraint::new(Vector2F::zero(), cx.window_size()),

View file

@ -18,7 +18,7 @@ use gpui::{
impl_actions, impl_internal_actions,
keymap_matcher::{KeymapContext, Keystroke},
platform::KeyDownEvent,
AnyViewHandle, AppContext, Drawable, Element, Entity, ModelHandle, Task, View, ViewContext,
AnyElement, AnyViewHandle, AppContext, Element, Entity, ModelHandle, Task, View, ViewContext,
ViewHandle, WeakViewHandle,
};
use project::{LocalWorktree, Project};
@ -387,7 +387,7 @@ impl View for TerminalView {
"Terminal"
}
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Element<Self> {
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> AnyElement<Self> {
let terminal_handle = self.terminal.clone().downgrade();
let self_id = cx.view_id();
@ -403,11 +403,10 @@ impl View for TerminalView {
focused,
self.should_show_cursor(focused, cx),
)
.contained()
.boxed(),
.contained(),
)
.with_child(ChildView::new(&self.context_menu, cx).boxed())
.boxed()
.with_child(ChildView::new(&self.context_menu, cx))
.into_any()
}
fn focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
@ -550,7 +549,7 @@ impl Item for TerminalView {
_detail: Option<usize>,
tab_theme: &theme::Tab,
cx: &gpui::AppContext,
) -> Element<T> {
) -> AnyElement<T> {
let title = self.terminal().read(cx).title();
Flex::row()
@ -561,11 +560,10 @@ impl Item for TerminalView {
.with_width(tab_theme.type_icon_width)
.aligned()
.contained()
.with_margin_right(tab_theme.spacing)
.boxed(),
.with_margin_right(tab_theme.spacing),
)
.with_child(Label::new(title, tab_theme.label.clone()).aligned().boxed())
.boxed()
.with_child(Label::new(title, tab_theme.label.clone()).aligned())
.into_any()
}
fn clone_on_split(