Avoid notifying editor when wrap width changes (#3612)

Wrap width is already assigned from within draw. It can be called
multiple times as taffy iteratively computes the layout.

This fixes a hang we were seeing in nightly when opening the chat panel.
This commit is contained in:
Max Brunsfeld 2023-12-12 12:32:05 -08:00 committed by GitHub
commit 31a4892a55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -184,7 +184,6 @@ impl WrapMap {
Ok((snapshot, edits)) => {
self.snapshot = snapshot;
self.edits_since_sync = self.edits_since_sync.compose(&edits);
cx.notify();
}
Err(wrap_task) => {
self.background_task = Some(cx.spawn(|this, mut cx| async move {

View file

@ -8300,7 +8300,9 @@ impl Editor {
self.style.as_ref()
}
pub fn set_wrap_width(&self, width: Option<Pixels>, cx: &mut AppContext) -> bool {
// Called by the element. This method is not designed to be called outside of the editor
// element's layout code because it does not notify when rewrapping is computed synchronously.
pub(crate) fn set_wrap_width(&self, width: Option<Pixels>, cx: &mut AppContext) -> bool {
self.display_map
.update(cx, |map, cx| map.set_wrap_width(width, cx))
}