Compute scrollbar markers asynchronously (#10080)
Refs #9647 Fixes https://github.com/zed-industries/zed/issues/9792 This pull request moves the computation of scrollbar markers off the main thread, to prevent them from grinding the editor to a halt when we have a lot of them (e.g., when there are lots of search results on a large file). With these changes we also avoid generating multiple quads for adjacent markers, thus fixing an issue where we stop drawing other primitives because we've drawn too many quads in the scrollbar. Release Notes: - Improved editor performance when displaying lots of search results, diagnostics, or symbol highlights in the scrollbar ([#9792](https://github.com/zed-industries/zed/issues/9792)). --------- Co-authored-by: Antonio Scandurra <me@as-cii.com> Co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
parent
7dbcace839
commit
3a0d3cee87
26 changed files with 532 additions and 379 deletions
|
@ -943,8 +943,9 @@ impl SearchableItem for TerminalView {
|
|||
}
|
||||
|
||||
/// Store matches returned from find_matches somewhere for rendering
|
||||
fn update_matches(&mut self, matches: Vec<Self::Match>, cx: &mut ViewContext<Self>) {
|
||||
self.terminal().update(cx, |term, _| term.matches = matches)
|
||||
fn update_matches(&mut self, matches: &[Self::Match], cx: &mut ViewContext<Self>) {
|
||||
self.terminal()
|
||||
.update(cx, |term, _| term.matches = matches.to_vec())
|
||||
}
|
||||
|
||||
/// Returns the selection content to pre-load into this search
|
||||
|
@ -958,14 +959,14 @@ impl SearchableItem for TerminalView {
|
|||
}
|
||||
|
||||
/// Focus match at given index into the Vec of matches
|
||||
fn activate_match(&mut self, index: usize, _: Vec<Self::Match>, cx: &mut ViewContext<Self>) {
|
||||
fn activate_match(&mut self, index: usize, _: &[Self::Match], cx: &mut ViewContext<Self>) {
|
||||
self.terminal()
|
||||
.update(cx, |term, _| term.activate_match(index));
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
/// Add selections for all matches given.
|
||||
fn select_matches(&mut self, matches: Vec<Self::Match>, cx: &mut ViewContext<Self>) {
|
||||
fn select_matches(&mut self, matches: &[Self::Match], cx: &mut ViewContext<Self>) {
|
||||
self.terminal()
|
||||
.update(cx, |term, _| term.select_matches(matches));
|
||||
cx.notify();
|
||||
|
@ -1003,7 +1004,7 @@ impl SearchableItem for TerminalView {
|
|||
/// Reports back to the search toolbar what the active match should be (the selection)
|
||||
fn active_match_index(
|
||||
&mut self,
|
||||
matches: Vec<Self::Match>,
|
||||
matches: &[Self::Match],
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Option<usize> {
|
||||
// Selection head might have a value if there's a selection that isn't
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue