mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-19 18:41:56 +03:00
WIP
This commit is contained in:
parent
b54f08db77
commit
83070a19c4
@ -361,7 +361,7 @@ impl View for ActivityIndicator {
|
|||||||
if let Some(action) = action {
|
if let Some(action) = action {
|
||||||
element = element
|
element = element
|
||||||
.with_cursor_style(CursorStyle::PointingHand)
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
.on_click(MouseButton::Left, move |_, cx| {
|
.on_click(MouseButton::Left, move |_, _, cx| {
|
||||||
cx.dispatch_any_action(action.boxed_clone())
|
cx.dispatch_any_action(action.boxed_clone())
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1476,12 +1476,7 @@ async fn test_host_disconnect(
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.downcast::<Editor>()
|
.downcast::<Editor>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
cx_b.read(|cx| {
|
assert!(cx_b.read(|cx| editor_b.is_focused(cx)));
|
||||||
assert_eq!(
|
|
||||||
cx.focused_view_id(workspace_b.window_id()),
|
|
||||||
Some(editor_b.id())
|
|
||||||
);
|
|
||||||
});
|
|
||||||
editor_b.update(cx_b, |editor, cx| editor.insert("X", cx));
|
editor_b.update(cx_b, |editor, cx| editor.insert("X", cx));
|
||||||
assert!(cx_b.is_window_edited(workspace_b.window_id()));
|
assert!(cx_b.is_window_edited(workspace_b.window_id()));
|
||||||
|
|
||||||
@ -1495,8 +1490,8 @@ async fn test_host_disconnect(
|
|||||||
assert!(worktree_a.read_with(cx_a, |tree, _| !tree.as_local().unwrap().is_shared()));
|
assert!(worktree_a.read_with(cx_a, |tree, _| !tree.as_local().unwrap().is_shared()));
|
||||||
|
|
||||||
// Ensure client B's edited state is reset and that the whole window is blurred.
|
// Ensure client B's edited state is reset and that the whole window is blurred.
|
||||||
cx_b.read(|cx| {
|
cx_b.read_window(|cx| {
|
||||||
assert_eq!(cx.focused_view_id(workspace_b.window_id()), None);
|
assert_eq!(cx.focused_view_id(), None);
|
||||||
});
|
});
|
||||||
assert!(!cx_b.is_window_edited(workspace_b.window_id()));
|
assert!(!cx_b.is_window_edited(workspace_b.window_id()));
|
||||||
|
|
||||||
|
@ -80,7 +80,6 @@ impl CollaboratorListPopover {
|
|||||||
collaborators.len(),
|
collaborators.len(),
|
||||||
Orientation::Top,
|
Orientation::Top,
|
||||||
0.,
|
0.,
|
||||||
cx,
|
|
||||||
move |_, index, cx| match &collaborators[index] {
|
move |_, index, cx| match &collaborators[index] {
|
||||||
Collaborator::SelfUser { username } => render_collaborator_list_entry(
|
Collaborator::SelfUser { username } => render_collaborator_list_entry(
|
||||||
index,
|
index,
|
||||||
|
@ -202,7 +202,7 @@ impl ContactList {
|
|||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
||||||
let list_state = ListState::new(0, Orientation::Top, 1000., cx, move |this, ix, cx| {
|
let list_state = ListState::new(0, Orientation::Top, 1000., move |this, ix, cx| {
|
||||||
let theme = cx.global::<Settings>().theme.clone();
|
let theme = cx.global::<Settings>().theme.clone();
|
||||||
let is_selected = this.selection == Some(ix);
|
let is_selected = this.selection == Some(ix);
|
||||||
let current_project_id = this.project.read(cx).remote_id();
|
let current_project_id = this.project.read(cx).remote_id();
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
use collections::CommandPaletteFilter;
|
use collections::CommandPaletteFilter;
|
||||||
use fuzzy::{StringMatch, StringMatchCandidate};
|
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions,
|
actions, elements::*, keymap_matcher::Keystroke, Action, AnyViewHandle, AppContext, Element,
|
||||||
elements::{ChildView, Flex, Label, ParentElement},
|
Entity, MouseState, View, ViewContext, ViewHandle,
|
||||||
keymap_matcher::Keystroke,
|
|
||||||
Action, AnyViewHandle, AppContext, Element, Entity, MouseState, View, ViewContext, ViewHandle,
|
|
||||||
};
|
};
|
||||||
use picker::{Picker, PickerDelegate};
|
use picker::{Picker, PickerDelegate};
|
||||||
use settings::Settings;
|
use settings::Settings;
|
||||||
@ -78,16 +76,13 @@ impl CommandPalette {
|
|||||||
|
|
||||||
fn toggle(_: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
fn toggle(_: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
||||||
let workspace = cx.handle();
|
let workspace = cx.handle();
|
||||||
let window_id = cx.window_id();
|
|
||||||
let focused_view_id = cx.focused_view_id().unwrap_or_else(|| workspace.id());
|
let focused_view_id = cx.focused_view_id().unwrap_or_else(|| workspace.id());
|
||||||
|
|
||||||
cx.as_mut().defer(move |cx| {
|
cx.defer(move |workspace, cx| {
|
||||||
let this = cx.add_view(&workspace, |cx| Self::new(focused_view_id, cx));
|
let this = cx.add_view(|cx| Self::new(focused_view_id, cx));
|
||||||
workspace.update(cx, |workspace, cx| {
|
workspace.toggle_modal(cx, |_, cx| {
|
||||||
workspace.toggle_modal(cx, |_, cx| {
|
cx.subscribe(&this, Self::on_event).detach();
|
||||||
cx.subscribe(&this, Self::on_event).detach();
|
this
|
||||||
this
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -109,8 +104,7 @@ impl CommandPalette {
|
|||||||
let focused_view_id = *focused_view_id;
|
let focused_view_id = *focused_view_id;
|
||||||
let action = action.boxed_clone();
|
let action = action.boxed_clone();
|
||||||
workspace.dismiss_modal(cx);
|
workspace.dismiss_modal(cx);
|
||||||
cx.as_mut()
|
cx.defer(move |_, cx| cx.dispatch_any_action_at(window_id, focused_view_id, action))
|
||||||
.defer(move |cx| cx.dispatch_any_action_at(window_id, focused_view_id, action))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,7 +119,7 @@ impl View for CommandPalette {
|
|||||||
"CommandPalette"
|
"CommandPalette"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> gpui::ElementBox {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
|
||||||
ChildView::new(&self.picker, cx).boxed()
|
ChildView::new(&self.picker, cx).boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +215,7 @@ impl PickerDelegate for CommandPalette {
|
|||||||
mouse_state: &mut MouseState,
|
mouse_state: &mut MouseState,
|
||||||
selected: bool,
|
selected: bool,
|
||||||
cx: &gpui::AppContext,
|
cx: &gpui::AppContext,
|
||||||
) -> gpui::ElementBox {
|
) -> ElementBox<Picker<Self>> {
|
||||||
let mat = &self.matches[ix];
|
let mat = &self.matches[ix];
|
||||||
let command = &self.actions[mat.candidate_id];
|
let command = &self.actions[mat.candidate_id];
|
||||||
let settings = cx.global::<Settings>();
|
let settings = cx.global::<Settings>();
|
||||||
|
@ -153,7 +153,7 @@ impl View for CopilotButton {
|
|||||||
.with_cursor_style(CursorStyle::PointingHand)
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
.on_click(MouseButton::Left, {
|
.on_click(MouseButton::Left, {
|
||||||
let status = status.clone();
|
let status = status.clone();
|
||||||
move |_, cx| match status {
|
move |_, _, cx| match status {
|
||||||
Status::Authorized => cx.dispatch_action(DeployCopilotMenu),
|
Status::Authorized => cx.dispatch_action(DeployCopilotMenu),
|
||||||
Status::Starting { ref task } => {
|
Status::Starting { ref task } => {
|
||||||
cx.dispatch_action(workspace::Toast::new(
|
cx.dispatch_action(workspace::Toast::new(
|
||||||
@ -162,7 +162,7 @@ impl View for CopilotButton {
|
|||||||
));
|
));
|
||||||
let window_id = cx.window_id();
|
let window_id = cx.window_id();
|
||||||
let task = task.to_owned();
|
let task = task.to_owned();
|
||||||
cx.spawn(|mut cx| async move {
|
cx.spawn(|this, mut cx| async move {
|
||||||
task.await;
|
task.await;
|
||||||
cx.update(|cx| {
|
cx.update(|cx| {
|
||||||
if let Some(copilot) = Copilot::global(cx) {
|
if let Some(copilot) = Copilot::global(cx) {
|
||||||
@ -199,13 +199,7 @@ impl View for CopilotButton {
|
|||||||
_ => cx.dispatch_action(SignIn),
|
_ => cx.dispatch_action(SignIn),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.with_tooltip::<Self, _>(
|
.with_tooltip::<Self>(0, "GitHub Copilot".into(), None, theme.tooltip.clone(), cx)
|
||||||
0,
|
|
||||||
"GitHub Copilot".into(),
|
|
||||||
None,
|
|
||||||
theme.tooltip.clone(),
|
|
||||||
cx,
|
|
||||||
)
|
|
||||||
.boxed(),
|
.boxed(),
|
||||||
)
|
)
|
||||||
.with_child(
|
.with_child(
|
||||||
|
@ -163,8 +163,10 @@ impl View for DiagnosticIndicator {
|
|||||||
.boxed()
|
.boxed()
|
||||||
})
|
})
|
||||||
.with_cursor_style(CursorStyle::PointingHand)
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
.on_click(MouseButton::Left, |_, cx| cx.dispatch_action(crate::Deploy))
|
.on_click(MouseButton::Left, |_, _, cx| {
|
||||||
.with_tooltip::<Summary, _>(
|
cx.dispatch_action(crate::Deploy)
|
||||||
|
})
|
||||||
|
.with_tooltip::<Summary>(
|
||||||
0,
|
0,
|
||||||
"Project Diagnostics".to_string(),
|
"Project Diagnostics".to_string(),
|
||||||
Some(Box::new(crate::Deploy)),
|
Some(Box::new(crate::Deploy)),
|
||||||
@ -200,7 +202,7 @@ impl View for DiagnosticIndicator {
|
|||||||
.boxed()
|
.boxed()
|
||||||
})
|
})
|
||||||
.with_cursor_style(CursorStyle::PointingHand)
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
.on_click(MouseButton::Left, |_, cx| {
|
.on_click(MouseButton::Left, |_, _, cx| {
|
||||||
cx.dispatch_action(GoToDiagnostic)
|
cx.dispatch_action(GoToDiagnostic)
|
||||||
})
|
})
|
||||||
.boxed(),
|
.boxed(),
|
||||||
|
@ -2574,10 +2574,8 @@ mod tests {
|
|||||||
|
|
||||||
let layouts = editor.update(cx, |editor, cx| {
|
let layouts = editor.update(cx, |editor, cx| {
|
||||||
let snapshot = editor.snapshot(cx);
|
let snapshot = editor.snapshot(cx);
|
||||||
let mut presenter = cx.build_window(window_id, 30., Default::default());
|
|
||||||
let layout_cx = presenter.build_layout_context(Vector2F::zero(), false, cx);
|
|
||||||
element
|
element
|
||||||
.layout_line_numbers(0..6, &Default::default(), false, &snapshot, &layout_cx)
|
.layout_line_numbers(0..6, &Default::default(), false, &snapshot, cx)
|
||||||
.0
|
.0
|
||||||
});
|
});
|
||||||
assert_eq!(layouts.len(), 6);
|
assert_eq!(layouts.len(), 6);
|
||||||
@ -2609,14 +2607,13 @@ mod tests {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let mut element = EditorElement::new(editor.downgrade(), editor.read(cx).style(cx));
|
let mut element = EditorElement::new(editor.downgrade(), editor.read(cx).style(cx));
|
||||||
|
let (size, mut state) = editor.update(cx, |editor, cx| {
|
||||||
let mut scene = SceneBuilder::new(1.0);
|
element.layout(
|
||||||
let mut presenter = cx.build_window(window_id, 30., Default::default());
|
SizeConstraint::new(vec2f(500., 500.), vec2f(500., 500.)),
|
||||||
let mut layout_cx = presenter.build_layout_context(Vector2F::zero(), false, cx);
|
editor,
|
||||||
let (size, mut state) = element.layout(
|
cx,
|
||||||
SizeConstraint::new(vec2f(500., 500.), vec2f(500., 500.)),
|
)
|
||||||
&mut layout_cx,
|
});
|
||||||
);
|
|
||||||
|
|
||||||
assert_eq!(state.position_map.line_layouts.len(), 4);
|
assert_eq!(state.position_map.line_layouts.len(), 4);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@ -2629,8 +2626,10 @@ mod tests {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Don't panic.
|
// Don't panic.
|
||||||
|
let mut scene = SceneBuilder::new(1.0);
|
||||||
let bounds = RectF::new(Default::default(), size);
|
let bounds = RectF::new(Default::default(), size);
|
||||||
let mut paint_cx = presenter.build_paint_context(&mut scene, bounds.size(), cx);
|
editor.update(cx, |editor, cx| {
|
||||||
element.paint(bounds, bounds, &mut state, &mut paint_cx);
|
element.paint(&mut scene, bounds, bounds, &mut state, editor, cx);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ impl View for DeployFeedbackButton {
|
|||||||
"DeployFeedbackButton"
|
"DeployFeedbackButton"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<'_, Self>) -> ElementBox {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
|
||||||
let active = self.active;
|
let active = self.active;
|
||||||
let theme = cx.global::<Settings>().theme.clone();
|
let theme = cx.global::<Settings>().theme.clone();
|
||||||
Stack::new()
|
Stack::new()
|
||||||
|
@ -13,7 +13,7 @@ use gpui::{
|
|||||||
elements::{ChildView, Flex, Label, ParentElement, Svg},
|
elements::{ChildView, Flex, Label, ParentElement, Svg},
|
||||||
platform::PromptLevel,
|
platform::PromptLevel,
|
||||||
serde_json, AnyViewHandle, AppContext, Element, ElementBox, Entity, ModelHandle, Task, View,
|
serde_json, AnyViewHandle, AppContext, Element, ElementBox, Entity, ModelHandle, Task, View,
|
||||||
ViewContext, ViewContext, ViewHandle,
|
ViewContext, ViewHandle,
|
||||||
};
|
};
|
||||||
use isahc::Request;
|
use isahc::Request;
|
||||||
use language::Buffer;
|
use language::Buffer;
|
||||||
@ -25,7 +25,7 @@ use util::ResultExt;
|
|||||||
use workspace::{
|
use workspace::{
|
||||||
item::{Item, ItemHandle},
|
item::{Item, ItemHandle},
|
||||||
searchable::{SearchableItem, SearchableItemHandle},
|
searchable::{SearchableItem, SearchableItemHandle},
|
||||||
AppState, Workspace,
|
AppState, Pane, Workspace,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{submit_feedback_button::SubmitFeedbackButton, system_specs::SystemSpecs};
|
use crate::{submit_feedback_button::SubmitFeedbackButton, system_specs::SystemSpecs};
|
||||||
@ -232,7 +232,7 @@ impl View for FeedbackEditor {
|
|||||||
"FeedbackEditor"
|
"FeedbackEditor"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
|
||||||
ChildView::new(&self.editor, cx).boxed()
|
ChildView::new(&self.editor, cx).boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +248,12 @@ impl Entity for FeedbackEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Item for FeedbackEditor {
|
impl Item for FeedbackEditor {
|
||||||
fn tab_content(&self, _: Option<usize>, style: &theme::Tab, _: &AppContext) -> ElementBox {
|
fn tab_content(
|
||||||
|
&self,
|
||||||
|
_: Option<usize>,
|
||||||
|
style: &theme::Tab,
|
||||||
|
_: &AppContext,
|
||||||
|
) -> ElementBox<Pane> {
|
||||||
Flex::row()
|
Flex::row()
|
||||||
.with_child(
|
.with_child(
|
||||||
Svg::new("icons/feedback_16.svg")
|
Svg::new("icons/feedback_16.svg")
|
||||||
|
@ -29,7 +29,7 @@ impl View for FeedbackInfoText {
|
|||||||
"FeedbackInfoText"
|
"FeedbackInfoText"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
|
||||||
let theme = cx.global::<Settings>().theme.clone();
|
let theme = cx.global::<Settings>().theme.clone();
|
||||||
|
|
||||||
Flex::row()
|
Flex::row()
|
||||||
|
@ -29,7 +29,7 @@ impl View for SubmitFeedbackButton {
|
|||||||
"SubmitFeedbackButton"
|
"SubmitFeedbackButton"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
|
||||||
let theme = cx.global::<Settings>().theme.clone();
|
let theme = cx.global::<Settings>().theme.clone();
|
||||||
enum SubmitFeedbackButton {}
|
enum SubmitFeedbackButton {}
|
||||||
MouseEventHandler::<SubmitFeedbackButton>::new(0, cx, |state, _| {
|
MouseEventHandler::<SubmitFeedbackButton>::new(0, cx, |state, _| {
|
||||||
|
@ -50,7 +50,7 @@ impl View for FileFinder {
|
|||||||
"FileFinder"
|
"FileFinder"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
|
||||||
ChildView::new(&self.picker, cx).boxed()
|
ChildView::new(&self.picker, cx).boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ impl PickerDelegate for FileFinder {
|
|||||||
mouse_state: &mut MouseState,
|
mouse_state: &mut MouseState,
|
||||||
selected: bool,
|
selected: bool,
|
||||||
cx: &AppContext,
|
cx: &AppContext,
|
||||||
) -> ElementBox {
|
) -> ElementBox<Picker<Self>> {
|
||||||
let path_match = &self.matches[ix];
|
let path_match = &self.matches[ix];
|
||||||
let settings = cx.global::<Settings>();
|
let settings = cx.global::<Settings>();
|
||||||
let style = settings.theme.picker.item.style_for(mouse_state, selected);
|
let style = settings.theme.picker.item.style_for(mouse_state, selected);
|
||||||
|
@ -936,6 +936,16 @@ impl AppContext {
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn read_window<T, F: FnOnce(&WindowContext) -> T>(
|
||||||
|
&self,
|
||||||
|
window_id: usize,
|
||||||
|
callback: F,
|
||||||
|
) -> Option<T> {
|
||||||
|
let window = self.windows.get(&window_id)?;
|
||||||
|
let window_context = WindowContext::immutable(self, &window, window_id);
|
||||||
|
Some(callback(&window_context))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn update_window<T, F: FnOnce(&mut WindowContext) -> T>(
|
pub fn update_window<T, F: FnOnce(&mut WindowContext) -> T>(
|
||||||
&mut self,
|
&mut self,
|
||||||
window_id: usize,
|
window_id: usize,
|
||||||
@ -943,13 +953,7 @@ impl AppContext {
|
|||||||
) -> Option<T> {
|
) -> Option<T> {
|
||||||
self.update(|app_context| {
|
self.update(|app_context| {
|
||||||
let mut window = app_context.windows.remove(&window_id)?;
|
let mut window = app_context.windows.remove(&window_id)?;
|
||||||
let mut window_context = WindowContext {
|
let mut window_context = WindowContext::mutable(app_context, &mut window, window_id);
|
||||||
app_context,
|
|
||||||
window: &mut window,
|
|
||||||
window_id,
|
|
||||||
refreshing: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
let result = callback(&mut window_context);
|
let result = callback(&mut window_context);
|
||||||
app_context.windows.insert(window_id, window);
|
app_context.windows.insert(window_id, window);
|
||||||
Some(result)
|
Some(result)
|
||||||
@ -1651,7 +1655,7 @@ impl AppContext {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
let mut window = Window::new(window_id, platform_window, self, build_root_view);
|
let mut window = Window::new(window_id, platform_window, self, build_root_view);
|
||||||
let scene = WindowContext::new(self, &mut window, window_id).build_scene();
|
let scene = WindowContext::mutable(self, &mut window, window_id).build_scene();
|
||||||
window.platform_window.present_scene(scene);
|
window.platform_window.present_scene(scene);
|
||||||
window
|
window
|
||||||
}
|
}
|
||||||
@ -3244,7 +3248,7 @@ impl<M> DerefMut for ModelContext<'_, M> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct ViewContext<'a, 'b, 'c, T: ?Sized> {
|
pub struct ViewContext<'a, 'b, 'c, T: ?Sized> {
|
||||||
window_context: WindowContextRef<'a, 'b, 'c>,
|
window_context: Reference<'c, WindowContext<'a, 'b>>,
|
||||||
view_id: usize,
|
view_id: usize,
|
||||||
view_type: PhantomData<T>,
|
view_type: PhantomData<T>,
|
||||||
}
|
}
|
||||||
@ -3266,7 +3270,7 @@ impl<T: View> DerefMut for ViewContext<'_, '_, '_, T> {
|
|||||||
impl<'a, 'b, 'c, V: View> ViewContext<'a, 'b, 'c, V> {
|
impl<'a, 'b, 'c, V: View> ViewContext<'a, 'b, 'c, V> {
|
||||||
pub(crate) fn mutable(window_context: &'c mut WindowContext<'a, 'b>, view_id: usize) -> Self {
|
pub(crate) fn mutable(window_context: &'c mut WindowContext<'a, 'b>, view_id: usize) -> Self {
|
||||||
Self {
|
Self {
|
||||||
window_context: WindowContextRef::Mutable(window_context),
|
window_context: Reference::Mutable(window_context),
|
||||||
view_id,
|
view_id,
|
||||||
view_type: PhantomData,
|
view_type: PhantomData,
|
||||||
}
|
}
|
||||||
@ -3274,7 +3278,7 @@ impl<'a, 'b, 'c, V: View> ViewContext<'a, 'b, 'c, V> {
|
|||||||
|
|
||||||
pub(crate) fn immutable(window_context: &'c WindowContext<'a, 'b>, view_id: usize) -> Self {
|
pub(crate) fn immutable(window_context: &'c WindowContext<'a, 'b>, view_id: usize) -> Self {
|
||||||
Self {
|
Self {
|
||||||
window_context: WindowContextRef::Immutable(window_context),
|
window_context: Reference::Immutable(window_context),
|
||||||
view_id,
|
view_id,
|
||||||
view_type: PhantomData,
|
view_type: PhantomData,
|
||||||
}
|
}
|
||||||
@ -3819,29 +3823,29 @@ impl<V: View> UpdateView for ViewContext<'_, '_, '_, V> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum WindowContextRef<'a, 'b, 'c> {
|
pub(crate) enum Reference<'a, T> {
|
||||||
Immutable(&'c WindowContext<'a, 'b>),
|
Immutable(&'a T),
|
||||||
Mutable(&'c mut WindowContext<'a, 'b>),
|
Mutable(&'a mut T),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b, 'c> Deref for WindowContextRef<'a, 'b, 'c> {
|
impl<'a, T> Deref for Reference<'a, T> {
|
||||||
type Target = WindowContext<'a, 'b>;
|
type Target = T;
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
match self {
|
match self {
|
||||||
WindowContextRef::Immutable(window_context) => window_context,
|
Reference::Immutable(target) => target,
|
||||||
WindowContextRef::Mutable(window_context) => window_context,
|
Reference::Mutable(target) => target,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b, 'c> DerefMut for WindowContextRef<'a, 'b, 'c> {
|
impl<'a, T> DerefMut for Reference<'a, T> {
|
||||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||||
match self {
|
match self {
|
||||||
WindowContextRef::Immutable(_) => {
|
Reference::Immutable(_) => {
|
||||||
panic!("cannot mutably deref an immutable WindowContext. this is a bug in GPUI.");
|
panic!("cannot mutably deref an immutable reference. this is a bug in GPUI.");
|
||||||
}
|
}
|
||||||
WindowContextRef::Mutable(window_context) => window_context,
|
Reference::Mutable(target) => target,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ use crate::{
|
|||||||
platform::{Event, InputHandler, KeyDownEvent, Platform},
|
platform::{Event, InputHandler, KeyDownEvent, Platform},
|
||||||
Action, AnyViewHandle, AppContext, Entity, FontCache, Handle, ModelContext, ModelHandle,
|
Action, AnyViewHandle, AppContext, Entity, FontCache, Handle, ModelContext, ModelHandle,
|
||||||
ReadModelWith, ReadViewWith, Task, UpdateModel, UpdateView, View, ViewContext, ViewHandle,
|
ReadModelWith, ReadViewWith, Task, UpdateModel, UpdateView, View, ViewContext, ViewHandle,
|
||||||
WeakHandle,
|
WeakHandle, WindowContext,
|
||||||
};
|
};
|
||||||
use collections::BTreeMap;
|
use collections::BTreeMap;
|
||||||
|
|
||||||
@ -114,6 +114,22 @@ impl TestAppContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn read_window<T, F: FnOnce(&WindowContext) -> T>(
|
||||||
|
&self,
|
||||||
|
window_id: usize,
|
||||||
|
callback: F,
|
||||||
|
) -> Option<T> {
|
||||||
|
self.cx.borrow().read_window(window_id, callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn update_window<T, F: FnOnce(&mut WindowContext) -> T>(
|
||||||
|
&mut self,
|
||||||
|
window_id: usize,
|
||||||
|
callback: F,
|
||||||
|
) -> Option<T> {
|
||||||
|
self.cx.borrow_mut().update_window(window_id, callback)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn add_model<T, F>(&mut self, build_model: F) -> ModelHandle<T>
|
pub fn add_model<T, F>(&mut self, build_model: F) -> ModelHandle<T>
|
||||||
where
|
where
|
||||||
T: Entity,
|
T: Entity,
|
||||||
@ -147,17 +163,6 @@ impl TestAppContext {
|
|||||||
self.cx.borrow().window_ids().collect()
|
self.cx.borrow().window_ids().collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn root_view(&self, window_id: usize) -> Option<AnyViewHandle> {
|
|
||||||
Some(
|
|
||||||
self.cx
|
|
||||||
.borrow()
|
|
||||||
.windows
|
|
||||||
.get(&window_id)?
|
|
||||||
.root_view()
|
|
||||||
.clone(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn read<T, F: FnOnce(&AppContext) -> T>(&self, callback: F) -> T {
|
pub fn read<T, F: FnOnce(&AppContext) -> T>(&self, callback: F) -> T {
|
||||||
callback(&*self.cx.borrow())
|
callback(&*self.cx.borrow())
|
||||||
}
|
}
|
||||||
@ -173,28 +178,6 @@ impl TestAppContext {
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render<F, V, T>(&mut self, handle: &ViewHandle<V>, f: F) -> T
|
|
||||||
where
|
|
||||||
F: FnOnce(&mut V, &mut ViewContext<V>) -> T,
|
|
||||||
V: View,
|
|
||||||
{
|
|
||||||
todo!()
|
|
||||||
// handle.update(&mut *self.cx.borrow_mut(), |view, cx| {
|
|
||||||
// let mut render_cx = ViewContext {
|
|
||||||
// app: cx,
|
|
||||||
// window_id: handle.window_id(),
|
|
||||||
// view_id: handle.id(),
|
|
||||||
// view_type: PhantomData,
|
|
||||||
// titlebar_height: 0.,
|
|
||||||
// hovered_region_ids: Default::default(),
|
|
||||||
// clicked_region_ids: None,
|
|
||||||
// refreshing: false,
|
|
||||||
// appearance: Appearance::Light,
|
|
||||||
// };
|
|
||||||
// f(view, &mut render_cx)
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn to_async(&self) -> AsyncAppContext {
|
pub fn to_async(&self) -> AsyncAppContext {
|
||||||
AsyncAppContext(self.cx.clone())
|
AsyncAppContext(self.cx.clone())
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ use sqlez::{
|
|||||||
use std::ops::{Deref, DerefMut, Range};
|
use std::ops::{Deref, DerefMut, Range};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use super::Reference;
|
||||||
|
|
||||||
pub struct Window {
|
pub struct Window {
|
||||||
pub(crate) root_view: Option<AnyViewHandle>,
|
pub(crate) root_view: Option<AnyViewHandle>,
|
||||||
pub(crate) focused_view_id: Option<usize>,
|
pub(crate) focused_view_id: Option<usize>,
|
||||||
@ -83,7 +85,7 @@ impl Window {
|
|||||||
appearance,
|
appearance,
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut window_context = WindowContext::new(cx, &mut window, window_id);
|
let mut window_context = WindowContext::mutable(cx, &mut window, window_id);
|
||||||
let root_view = window_context
|
let root_view = window_context
|
||||||
.build_and_insert_view(ParentId::Root, |cx| Some(build_view(cx)))
|
.build_and_insert_view(ParentId::Root, |cx| Some(build_view(cx)))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@ -101,8 +103,8 @@ impl Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct WindowContext<'a: 'b, 'b> {
|
pub struct WindowContext<'a: 'b, 'b> {
|
||||||
pub(crate) app_context: &'a mut AppContext,
|
pub(crate) app_context: Reference<'a, AppContext>,
|
||||||
pub(crate) window: &'b mut Window, // TODO: make this private?
|
pub(crate) window: Reference<'b, Window>,
|
||||||
pub(crate) window_id: usize,
|
pub(crate) window_id: usize,
|
||||||
pub(crate) refreshing: bool,
|
pub(crate) refreshing: bool,
|
||||||
}
|
}
|
||||||
@ -111,7 +113,7 @@ impl Deref for WindowContext<'_, '_> {
|
|||||||
type Target = AppContext;
|
type Target = AppContext;
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
self.app_context
|
&self.app_context
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,10 +150,23 @@ impl UpgradeViewHandle for WindowContext<'_, '_> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a: 'b, 'b> WindowContext<'a, 'b> {
|
impl<'a: 'b, 'b> WindowContext<'a, 'b> {
|
||||||
pub fn new(app_context: &'a mut AppContext, window: &'b mut Window, window_id: usize) -> Self {
|
pub fn mutable(
|
||||||
|
app_context: &'a mut AppContext,
|
||||||
|
window: &'b mut Window,
|
||||||
|
window_id: usize,
|
||||||
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
app_context,
|
app_context: Reference::Mutable(app_context),
|
||||||
window,
|
window: Reference::Mutable(window),
|
||||||
|
window_id,
|
||||||
|
refreshing: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn immutable(app_context: &'a AppContext, window: &'b Window, window_id: usize) -> Self {
|
||||||
|
Self {
|
||||||
|
app_context: Reference::Immutable(app_context),
|
||||||
|
window: Reference::Immutable(window),
|
||||||
window_id,
|
window_id,
|
||||||
refreshing: false,
|
refreshing: false,
|
||||||
}
|
}
|
||||||
@ -162,7 +177,7 @@ impl<'a: 'b, 'b> WindowContext<'a, 'b> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn app_context(&mut self) -> &mut AppContext {
|
pub fn app_context(&mut self) -> &mut AppContext {
|
||||||
self.app_context
|
&mut self.app_context
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn root_view(&self) -> &AnyViewHandle {
|
pub fn root_view(&self) -> &AnyViewHandle {
|
||||||
@ -406,7 +421,8 @@ impl<'a: 'b, 'b> WindowContext<'a, 'b> {
|
|||||||
MouseEvent::Hover(_) => {
|
MouseEvent::Hover(_) => {
|
||||||
let mut highest_z_index = None;
|
let mut highest_z_index = None;
|
||||||
let mouse_position = self.window.mouse_position.clone();
|
let mouse_position = self.window.mouse_position.clone();
|
||||||
for (region, z_index) in self.window.mouse_regions.iter().rev() {
|
let window = &mut *self.window;
|
||||||
|
for (region, z_index) in window.mouse_regions.iter().rev() {
|
||||||
// Allow mouse regions to appear transparent to hovers
|
// Allow mouse regions to appear transparent to hovers
|
||||||
if !region.hoverable {
|
if !region.hoverable {
|
||||||
continue;
|
continue;
|
||||||
@ -424,7 +440,7 @@ impl<'a: 'b, 'b> WindowContext<'a, 'b> {
|
|||||||
// highest_z_index is set.
|
// highest_z_index is set.
|
||||||
if contains_mouse && z_index == highest_z_index.unwrap() {
|
if contains_mouse && z_index == highest_z_index.unwrap() {
|
||||||
//Ensure that hover entrance events aren't sent twice
|
//Ensure that hover entrance events aren't sent twice
|
||||||
if self.window.hovered_region_ids.insert(region.id()) {
|
if window.hovered_region_ids.insert(region.id()) {
|
||||||
valid_regions.push(region.clone());
|
valid_regions.push(region.clone());
|
||||||
if region.notify_on_hover {
|
if region.notify_on_hover {
|
||||||
notified_views.insert(region.id().view_id());
|
notified_views.insert(region.id().view_id());
|
||||||
@ -432,7 +448,7 @@ impl<'a: 'b, 'b> WindowContext<'a, 'b> {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Ensure that hover exit events aren't sent twice
|
// Ensure that hover exit events aren't sent twice
|
||||||
if self.window.hovered_region_ids.remove(®ion.id()) {
|
if window.hovered_region_ids.remove(®ion.id()) {
|
||||||
valid_regions.push(region.clone());
|
valid_regions.push(region.clone());
|
||||||
if region.notify_on_hover {
|
if region.notify_on_hover {
|
||||||
notified_views.insert(region.id().view_id());
|
notified_views.insert(region.id().view_id());
|
||||||
|
@ -33,7 +33,7 @@ pub trait PickerDelegate: View {
|
|||||||
state: &mut MouseState,
|
state: &mut MouseState,
|
||||||
selected: bool,
|
selected: bool,
|
||||||
cx: &AppContext,
|
cx: &AppContext,
|
||||||
) -> ElementBox<Self>;
|
) -> ElementBox<Picker<Self>>;
|
||||||
fn center_selection_after_match_updates(&self) -> bool {
|
fn center_selection_after_match_updates(&self) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -1238,7 +1238,7 @@ impl ProjectPanel {
|
|||||||
.is_some()
|
.is_some()
|
||||||
{
|
{
|
||||||
if let Some(this) = this.upgrade(cx) {
|
if let Some(this) = this.upgrade(cx) {
|
||||||
this.update(cx, |this, _, _| {
|
this.update(cx, |this, _| {
|
||||||
this.dragged_entry_destination = if matches!(kind, EntryKind::File(_)) {
|
this.dragged_entry_destination = if matches!(kind, EntryKind::File(_)) {
|
||||||
path.parent().map(|parent| Arc::from(parent))
|
path.parent().map(|parent| Arc::from(parent))
|
||||||
} else {
|
} else {
|
||||||
|
@ -348,7 +348,7 @@ impl BufferSearchBar {
|
|||||||
cx.dispatch_any_action(option.to_toggle_action())
|
cx.dispatch_any_action(option.to_toggle_action())
|
||||||
})
|
})
|
||||||
.with_cursor_style(CursorStyle::PointingHand)
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
.with_tooltip::<Self, _, _>(
|
.with_tooltip::<Self>(
|
||||||
option as usize,
|
option as usize,
|
||||||
format!("Toggle {}", option.label()),
|
format!("Toggle {}", option.label()),
|
||||||
Some(option.to_toggle_action()),
|
Some(option.to_toggle_action()),
|
||||||
@ -394,10 +394,10 @@ impl BufferSearchBar {
|
|||||||
})
|
})
|
||||||
.on_click(MouseButton::Left, {
|
.on_click(MouseButton::Left, {
|
||||||
let action = action.boxed_clone();
|
let action = action.boxed_clone();
|
||||||
mov_, _, cx| cx.dispatch_any_action(action.boxed_clone())
|
move |_, _, cx| cx.dispatch_any_action(action.boxed_clone())
|
||||||
})
|
})
|
||||||
.with_cursor_style(CursorStyle::PointingHand)
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
.with_tooltip::<NavButton,_ _,, _>(
|
.with_tooltip::<NavButton>(
|
||||||
direction as usize,
|
direction as usize,
|
||||||
tooltip.to_string(),
|
tooltip.to_string(),
|
||||||
Some(action),
|
Some(action),
|
||||||
@ -432,7 +432,7 @@ impl BufferSearchBar {
|
|||||||
})
|
})
|
||||||
.on_click(MouseButton::Left, {
|
.on_click(MouseButton::Left, {
|
||||||
let action = action.boxed_clone();
|
let action = action.boxed_clone();
|
||||||
move |_, _, _, cx| cx.dispatch_any_action(action.boxed_clone())
|
move |_, _, cx| cx.dispatch_any_action(action.boxed_clone())
|
||||||
})
|
})
|
||||||
.with_cursor_style(CursorStyle::PointingHand)
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
.with_tooltip::<CloseButton>(0, tooltip.to_string(), Some(action), tooltip_style, cx)
|
.with_tooltip::<CloseButton>(0, tooltip.to_string(), Some(action), tooltip_style, cx)
|
||||||
|
@ -198,7 +198,7 @@ impl View for ProjectSearchView {
|
|||||||
.flex(1., true)
|
.flex(1., true)
|
||||||
.boxed()
|
.boxed()
|
||||||
})
|
})
|
||||||
.on_down(MouseButton::Left, |_, _, _, cx| {
|
.on_down(MouseButton::Left, |_, _, cx| {
|
||||||
cx.focus_parent_view();
|
cx.focus_parent_view();
|
||||||
})
|
})
|
||||||
.boxed()
|
.boxed()
|
||||||
@ -775,12 +775,13 @@ impl ProjectSearchBar {
|
|||||||
.with_style(style.container)
|
.with_style(style.container)
|
||||||
.boxed()
|
.boxed()
|
||||||
})
|
})
|
||||||
.on_click(MouseButton::Le {
|
.on_click(MouseButton::Left, {
|
||||||
let action = action.boxed_clone();
|
let action = action.boxed_clone();
|
||||||
move |_, _, cx| cx.dispatch_any_action(action.boxed_clone())
|
move |_, _, cx| cx.dispatch_any_action(action.boxed_clone())
|
||||||
_, })
|
})
|
||||||
.with_cursor_style(CursorStyle::PointingHand)
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
.with_tooltip::<NavButton, _ direction as usize,
|
.with_tooltip::<NavButton>(
|
||||||
|
direction as usize,
|
||||||
tooltip.to_string(),
|
tooltip.to_string(),
|
||||||
Some(action),
|
Some(action),
|
||||||
tooltip_style,
|
tooltip_style,
|
||||||
|
@ -812,7 +812,7 @@ impl Element<TerminalView> for TerminalElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(element) = &mut layout.hyperlink_tooltip {
|
if let Some(element) = &mut layout.hyperlink_tooltip {
|
||||||
Element::paint(element, scene, origin, visible_bounds, view, view, cx)
|
element.paint(scene, origin, visible_bounds, view, cx)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ impl PickerDelegate for ThemeSelector {
|
|||||||
mouse_state: &mut MouseState,
|
mouse_state: &mut MouseState,
|
||||||
selected: bool,
|
selected: bool,
|
||||||
cx: &AppContext,
|
cx: &AppContext,
|
||||||
) -> ElementBox {
|
) -> ElementBox<Picker<Self>> {
|
||||||
let settings = cx.global::<Settings>();
|
let settings = cx.global::<Settings>();
|
||||||
let theme = &settings.theme;
|
let theme = &settings.theme;
|
||||||
let theme_match = &self.matches[ix];
|
let theme_match = &self.matches[ix];
|
||||||
@ -255,7 +255,7 @@ impl View for ThemeSelector {
|
|||||||
"ThemeSelector"
|
"ThemeSelector"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
|
||||||
ChildView::new(&self.picker, cx).boxed()
|
ChildView::new(&self.picker, cx).boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,18 +570,18 @@ mod test {
|
|||||||
|
|
||||||
cx.assert_all(indoc! {"
|
cx.assert_all(indoc! {"
|
||||||
The ˇquick
|
The ˇquick
|
||||||
|
|
||||||
brown fox jumps
|
brown fox jumps
|
||||||
overˇ the lazy doˇg"})
|
overˇ the lazy doˇg"})
|
||||||
.await;
|
.await;
|
||||||
cx.assert(indoc! {"
|
cx.assert(indoc! {"
|
||||||
The quiˇck
|
The quiˇck
|
||||||
|
|
||||||
brown"})
|
brown"})
|
||||||
.await;
|
.await;
|
||||||
cx.assert(indoc! {"
|
cx.assert(indoc! {"
|
||||||
The quiˇck
|
The quiˇck
|
||||||
|
|
||||||
"})
|
"})
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
@ -611,16 +611,16 @@ mod test {
|
|||||||
let mut cx = NeovimBackedTestContext::new(cx).await.binding(["e"]);
|
let mut cx = NeovimBackedTestContext::new(cx).await.binding(["e"]);
|
||||||
cx.assert_all(indoc! {"
|
cx.assert_all(indoc! {"
|
||||||
Thˇe quicˇkˇ-browˇn
|
Thˇe quicˇkˇ-browˇn
|
||||||
|
|
||||||
|
|
||||||
fox_jumpˇs oveˇr
|
fox_jumpˇs oveˇr
|
||||||
thˇe"})
|
thˇe"})
|
||||||
.await;
|
.await;
|
||||||
let mut cx = cx.binding(["shift-e"]);
|
let mut cx = cx.binding(["shift-e"]);
|
||||||
cx.assert_all(indoc! {"
|
cx.assert_all(indoc! {"
|
||||||
Thˇe quicˇkˇ-browˇn
|
Thˇe quicˇkˇ-browˇn
|
||||||
|
|
||||||
|
|
||||||
fox_jumpˇs oveˇr
|
fox_jumpˇs oveˇr
|
||||||
thˇe"})
|
thˇe"})
|
||||||
.await;
|
.await;
|
||||||
@ -669,7 +669,7 @@ mod test {
|
|||||||
["g", "g"],
|
["g", "g"],
|
||||||
indoc! {"
|
indoc! {"
|
||||||
The qˇuick
|
The qˇuick
|
||||||
|
|
||||||
brown fox jumps
|
brown fox jumps
|
||||||
over ˇthe laˇzy dog"},
|
over ˇthe laˇzy dog"},
|
||||||
)
|
)
|
||||||
@ -677,8 +677,8 @@ mod test {
|
|||||||
cx.assert_binding_matches(
|
cx.assert_binding_matches(
|
||||||
["g", "g"],
|
["g", "g"],
|
||||||
indoc! {"
|
indoc! {"
|
||||||
|
|
||||||
|
|
||||||
brown fox jumps
|
brown fox jumps
|
||||||
over the laˇzy dog"},
|
over the laˇzy dog"},
|
||||||
)
|
)
|
||||||
@ -687,7 +687,7 @@ mod test {
|
|||||||
["2", "g", "g"],
|
["2", "g", "g"],
|
||||||
indoc! {"
|
indoc! {"
|
||||||
ˇ
|
ˇ
|
||||||
|
|
||||||
brown fox jumps
|
brown fox jumps
|
||||||
over the lazydog"},
|
over the lazydog"},
|
||||||
)
|
)
|
||||||
@ -701,7 +701,7 @@ mod test {
|
|||||||
["shift-g"],
|
["shift-g"],
|
||||||
indoc! {"
|
indoc! {"
|
||||||
The qˇuick
|
The qˇuick
|
||||||
|
|
||||||
brown fox jumps
|
brown fox jumps
|
||||||
over ˇthe laˇzy dog"},
|
over ˇthe laˇzy dog"},
|
||||||
)
|
)
|
||||||
@ -709,8 +709,8 @@ mod test {
|
|||||||
cx.assert_binding_matches(
|
cx.assert_binding_matches(
|
||||||
["shift-g"],
|
["shift-g"],
|
||||||
indoc! {"
|
indoc! {"
|
||||||
|
|
||||||
|
|
||||||
brown fox jumps
|
brown fox jumps
|
||||||
over the laˇzy dog"},
|
over the laˇzy dog"},
|
||||||
)
|
)
|
||||||
@ -719,7 +719,7 @@ mod test {
|
|||||||
["2", "shift-g"],
|
["2", "shift-g"],
|
||||||
indoc! {"
|
indoc! {"
|
||||||
ˇ
|
ˇ
|
||||||
|
|
||||||
brown fox jumps
|
brown fox jumps
|
||||||
over the lazydog"},
|
over the lazydog"},
|
||||||
)
|
)
|
||||||
@ -999,7 +999,7 @@ mod test {
|
|||||||
let test_case = indoc! {"
|
let test_case = indoc! {"
|
||||||
ˇaaaˇbˇ ˇbˇ ˇbˇbˇ aˇaaˇbaaa
|
ˇaaaˇbˇ ˇbˇ ˇbˇbˇ aˇaaˇbaaa
|
||||||
ˇ ˇbˇaaˇa ˇbˇbˇb
|
ˇ ˇbˇaaˇa ˇbˇbˇb
|
||||||
ˇ
|
ˇ
|
||||||
ˇb
|
ˇb
|
||||||
"};
|
"};
|
||||||
|
|
||||||
@ -1017,7 +1017,7 @@ mod test {
|
|||||||
let test_case = indoc! {"
|
let test_case = indoc! {"
|
||||||
ˇaaaˇbˇ ˇbˇ ˇbˇbˇ aˇaaˇbaaa
|
ˇaaaˇbˇ ˇbˇ ˇbˇbˇ aˇaaˇbaaa
|
||||||
ˇ ˇbˇaaˇa ˇbˇbˇb
|
ˇ ˇbˇaaˇa ˇbˇbˇb
|
||||||
ˇ
|
ˇ
|
||||||
ˇb
|
ˇb
|
||||||
"};
|
"};
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ impl View for BaseKeymapSelector {
|
|||||||
"BaseKeymapSelector"
|
"BaseKeymapSelector"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut gpui::ViewContext<'_, Self>) -> gpui::ElementBox {
|
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> gpui::ElementBox<Self> {
|
||||||
ChildView::new(&self.picker, cx).boxed()
|
ChildView::new(&self.picker, cx).boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ impl View for WelcomePage {
|
|||||||
"WelcomePage"
|
"WelcomePage"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut gpui::ViewContext<'_, Self>) -> ElementBox {
|
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> ElementBox {
|
||||||
let self_handle = cx.handle();
|
let self_handle = cx.handle();
|
||||||
let settings = cx.global::<Settings>();
|
let settings = cx.global::<Settings>();
|
||||||
let theme = settings.theme.clone();
|
let theme = settings.theme.clone();
|
||||||
|
@ -1404,7 +1404,7 @@ impl Pane {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ConstrainedBox::new(
|
ConstrainedBox::new(
|
||||||
Canvas::new(move |scene, bounds, _, _, cx| {
|
Canvas::new(move |scene, bounds, _, _, _| {
|
||||||
if let Some(color) = icon_color {
|
if let Some(color) = icon_color {
|
||||||
let square = RectF::new(bounds.origin(), vec2f(diameter, diameter));
|
let square = RectF::new(bounds.origin(), vec2f(diameter, diameter));
|
||||||
scene.push_quad(Quad {
|
scene.push_quad(Quad {
|
||||||
|
@ -69,7 +69,7 @@ impl View for SharedScreen {
|
|||||||
|
|
||||||
let frame = self.frame.clone();
|
let frame = self.frame.clone();
|
||||||
MouseEventHandler::<Focus, _>::new(0, cx, |_, cx| {
|
MouseEventHandler::<Focus, _>::new(0, cx, |_, cx| {
|
||||||
Canvas::new(move |scene, bounds, _, _, cx| {
|
Canvas::new(move |scene, bounds, _, _, _| {
|
||||||
if let Some(frame) = frame.clone() {
|
if let Some(frame) = frame.clone() {
|
||||||
let size = constrain_size_preserving_aspect_ratio(
|
let size = constrain_size_preserving_aspect_ratio(
|
||||||
bounds.size(),
|
bounds.size(),
|
||||||
|
Loading…
Reference in New Issue
Block a user