Scope line layout cache to each window (#7235)

This improves a performance problem we were observing when having
multiple windows updating at the same time, where each window would
invalidate the other window's layout cache.

Release Notes:

- Improved performance when having multiple Zed windows open.

Co-authored-by: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2024-02-02 10:11:20 -07:00 committed by GitHub
parent 5360c0ea28
commit a0b52cc69a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 104 additions and 78 deletions

View file

@ -4,8 +4,8 @@ use gpui::{
ElementContext, ElementId, FocusHandle, Font, FontStyle, FontWeight, HighlightStyle, Hsla,
InputHandler, InteractiveBounds, InteractiveElement, InteractiveElementState, Interactivity,
IntoElement, LayoutId, Model, ModelContext, ModifiersChangedEvent, MouseButton, MouseMoveEvent,
Pixels, Point, ShapedLine, StatefulInteractiveElement, Styled, TextRun, TextStyle, TextSystem,
UnderlineStyle, WeakView, WhiteSpace, WindowContext,
Pixels, Point, ShapedLine, StatefulInteractiveElement, Styled, TextRun, TextStyle,
UnderlineStyle, WeakView, WhiteSpace, WindowContext, WindowTextSystem,
};
use itertools::Itertools;
use language::CursorShape;
@ -185,7 +185,7 @@ impl TerminalElement {
grid: &Vec<IndexedCell>,
text_style: &TextStyle,
// terminal_theme: &TerminalStyle,
text_system: &TextSystem,
text_system: &WindowTextSystem,
hyperlink: Option<(HighlightStyle, &RangeInclusive<AlacPoint>)>,
cx: &WindowContext<'_>,
) -> (Vec<LayoutCell>, Vec<LayoutRect>) {