Remove ViewContext::dispatch_any_action

This commit is contained in:
Antonio Scandurra 2023-05-01 14:09:39 +02:00
parent 029538fe21
commit d815fc88ae
11 changed files with 197 additions and 202 deletions

View file

@ -3199,11 +3199,13 @@ impl Editor {
.with_cursor_style(CursorStyle::PointingHand)
.with_padding(Padding::uniform(3.))
.on_click(MouseButton::Left, {
move |_, _, cx| {
cx.dispatch_any_action(match fold_status {
FoldStatus::Folded => Box::new(UnfoldAt { buffer_row }),
FoldStatus::Foldable => Box::new(FoldAt { buffer_row }),
});
move |_, editor, cx| match fold_status {
FoldStatus::Folded => {
editor.unfold_at(&UnfoldAt { buffer_row }, cx);
}
FoldStatus::Foldable => {
editor.fold_at(&FoldAt { buffer_row }, cx);
}
}
})
.into_any()