Skip to content

Commit

Permalink
Do not reuse render cache for nested items whose parents are re-rende…
Browse files Browse the repository at this point in the history
…red (#21165)

Fixes a bug with terminal splits panicking during writing a command in
the command input

Release Notes:

- N/A

Co-authored-by: Antonio Scandurra <[email protected]>
  • Loading branch information
SomeoneToIgnore and as-cii authored Nov 25, 2024
1 parent 08b214d commit b83f104
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/gpui/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::{
};
use anyhow::{Context, Result};
use refineable::Refineable;
use std::mem;
use std::{
any::{type_name, TypeId},
fmt,
Expand Down Expand Up @@ -341,11 +342,13 @@ impl Element for AnyView {
}
}

let refreshing = mem::replace(&mut cx.window.refreshing, true);
let prepaint_start = cx.prepaint_index();
let mut element = (self.render)(self, cx);
element.layout_as_root(bounds.size.into(), cx);
element.prepaint_at(bounds.origin, cx);
let prepaint_end = cx.prepaint_index();
cx.window.refreshing = refreshing;

(
Some(element),
Expand Down Expand Up @@ -382,7 +385,9 @@ impl Element for AnyView {
let paint_start = cx.paint_index();

if let Some(element) = element {
let refreshing = mem::replace(&mut cx.window.refreshing, true);
element.paint(cx);
cx.window.refreshing = refreshing;
} else {
cx.reuse_paint(element_state.paint_range.clone());
}
Expand Down

0 comments on commit b83f104

Please sign in to comment.