mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-10 20:41:59 +00:00
Put context parameter last in toggle_modal callback
This is more consistent with our treatment of context params everywhere else.
This commit is contained in:
parent
6b5cab5db1
commit
9c68c3e8a9
8 changed files with 9 additions and 9 deletions
|
@ -71,7 +71,7 @@ impl CommandPalette {
|
|||
cx.as_mut().defer(move |cx| {
|
||||
let this = cx.add_view(window_id, |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();
|
||||
this
|
||||
});
|
||||
|
|
|
@ -159,7 +159,7 @@ impl PickerDelegate for ContactFinder {
|
|||
|
||||
impl ContactFinder {
|
||||
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
||||
workspace.toggle_modal(cx, |cx, workspace| {
|
||||
workspace.toggle_modal(cx, |workspace, cx| {
|
||||
let finder = cx.add_view(|cx| Self::new(workspace.user_store().clone(), cx));
|
||||
cx.subscribe(&finder, Self::on_event).detach();
|
||||
finder
|
||||
|
|
|
@ -85,7 +85,7 @@ impl FileFinder {
|
|||
}
|
||||
|
||||
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
||||
workspace.toggle_modal(cx, |cx, workspace| {
|
||||
workspace.toggle_modal(cx, |workspace, cx| {
|
||||
let project = workspace.project().clone();
|
||||
let finder = cx.add_view(|cx| Self::new(project, cx));
|
||||
cx.subscribe(&finder, Self::on_event).detach();
|
||||
|
|
|
@ -62,7 +62,7 @@ impl GoToLine {
|
|||
.active_item(cx)
|
||||
.and_then(|active_item| active_item.downcast::<Editor>())
|
||||
{
|
||||
workspace.toggle_modal(cx, |cx, _| {
|
||||
workspace.toggle_modal(cx, |_, cx| {
|
||||
let view = cx.add_view(|cx| GoToLine::new(editor, cx));
|
||||
cx.subscribe(&view, Self::on_event).detach();
|
||||
view
|
||||
|
|
|
@ -87,7 +87,7 @@ impl OutlineView {
|
|||
.read(cx)
|
||||
.outline(Some(cx.global::<Settings>().theme.editor.syntax.as_ref()));
|
||||
if let Some(outline) = buffer {
|
||||
workspace.toggle_modal(cx, |cx, _| {
|
||||
workspace.toggle_modal(cx, |_, cx| {
|
||||
let view = cx.add_view(|cx| OutlineView::new(outline, editor, cx));
|
||||
cx.subscribe(&view, Self::on_event).detach();
|
||||
view
|
||||
|
|
|
@ -71,7 +71,7 @@ impl ProjectSymbolsView {
|
|||
}
|
||||
|
||||
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
||||
workspace.toggle_modal(cx, |cx, workspace| {
|
||||
workspace.toggle_modal(cx, |workspace, cx| {
|
||||
let project = workspace.project().clone();
|
||||
let symbols = cx.add_view(|cx| Self::new(project, cx));
|
||||
cx.subscribe(&symbols, Self::on_event).detach();
|
||||
|
|
|
@ -66,7 +66,7 @@ impl ThemeSelector {
|
|||
|
||||
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
||||
let themes = workspace.themes();
|
||||
workspace.toggle_modal(cx, |cx, _| {
|
||||
workspace.toggle_modal(cx, |_, cx| {
|
||||
let this = cx.add_view(|cx| Self::new(themes, cx));
|
||||
cx.subscribe(&this, Self::on_event).detach();
|
||||
this
|
||||
|
|
|
@ -943,7 +943,7 @@ impl Workspace {
|
|||
) -> Option<ViewHandle<V>>
|
||||
where
|
||||
V: 'static + View,
|
||||
F: FnOnce(&mut ViewContext<Self>, &mut Self) -> ViewHandle<V>,
|
||||
F: FnOnce(&mut Self, &mut ViewContext<Self>) -> ViewHandle<V>,
|
||||
{
|
||||
cx.notify();
|
||||
// Whatever modal was visible is getting clobbered. If its the same type as V, then return
|
||||
|
@ -953,7 +953,7 @@ impl Workspace {
|
|||
cx.focus_self();
|
||||
Some(already_open_modal)
|
||||
} else {
|
||||
let modal = add_view(cx, self);
|
||||
let modal = add_view(self, cx);
|
||||
cx.focus(&modal);
|
||||
self.modal = Some(modal.into());
|
||||
None
|
||||
|
|
Loading…
Reference in a new issue