Pass a &mut BlockContext
when rendering blocks
This wraps and derefs to `RenderContext<Editor>`, so that we can easily use `MouseEventHandler`s in blocks.
This commit is contained in:
parent
9fa03b2f28
commit
aefdde66a6
4 changed files with 83 additions and 82 deletions
|
@ -4745,7 +4745,7 @@ impl Editor {
|
|||
height: 1,
|
||||
render: Arc::new({
|
||||
let editor = rename_editor.clone();
|
||||
move |cx: &BlockContext| {
|
||||
move |cx: &mut BlockContext| {
|
||||
ChildView::new(editor.clone())
|
||||
.contained()
|
||||
.with_padding_left(cx.anchor_x)
|
||||
|
@ -5866,7 +5866,7 @@ pub fn diagnostic_block_renderer(diagnostic: Diagnostic, is_valid: bool) -> Rend
|
|||
highlighted_lines.push(highlight_diagnostic_message(line));
|
||||
}
|
||||
|
||||
Arc::new(move |cx: &BlockContext| {
|
||||
Arc::new(move |cx: &mut BlockContext| {
|
||||
let settings = cx.global::<Settings>();
|
||||
let theme = &settings.theme.editor;
|
||||
let style = diagnostic_style(diagnostic.severity, is_valid, theme);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue