Skip to content

Commit

Permalink
assistant_context_editor: Fix patch block not rendering due to window…
Browse files Browse the repository at this point in the history
… reborrow (cherry-pick #24461) (#24464)

Cherry-picked assistant_context_editor: Fix patch block not rendering
due to window reborrow (#24461)

This PR fixes an issue where the Assistant patch block was not being
rendered when using "Suggest Edits".

The issue was that the `BlockContext` already has a borrow of the
`Window`, so we can't use `update_in` to reborrow the window.

The fix is to reuse the existing `&mut Window` reference from the
`BlockContext` so we don't need to `update_in`.

Closes #24169.

Release Notes:

- Assistant: Fixed an issue where the patch block was not being rendered
when using "Suggest Edits".

---------

Co-authored-by: Max <[email protected]>

Co-authored-by: Marshall Bowers <[email protected]>
Co-authored-by: Max <[email protected]>
  • Loading branch information
3 people authored Feb 7, 2025
1 parent 37913f5 commit d60d102
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/assistant_context_editor/src/context_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -979,12 +979,13 @@ impl ContextEditor {
let render_block: RenderBlock = Arc::new({
let this = this.clone();
let patch_range = range.clone();
move |cx: &mut BlockContext<'_, '_>| {
move |cx: &mut BlockContext| {
let max_width = cx.max_width;
let gutter_width = cx.gutter_dimensions.full_width();
let block_id = cx.block_id;
let selected = cx.selected;
this.update_in(cx, |this, window, cx| {
let window = &mut cx.window;
this.update(cx.app, |this, cx| {
this.render_patch_block(
patch_range.clone(),
max_width,
Expand Down

0 comments on commit d60d102

Please sign in to comment.