Follow up to #52502 This fixes a severe hang in the markdown preview when searching for text caused by `paint_search_highlights`. We were iterating over all lines for each highlight, and for each highlight we called `layout.line_layout_for_index` which internally would iterate over all the lines of the text layout. With this optimisation we paint all highlights in one pass. We sort the highlight ranges, iterate through the lines and only access `WrappedLineSegments` when we actually have a highlight in that line. E.g. if you copy this text (https://gist.github.com/bennetbo/e313f3023da9fec42e090177a5373152) into the editor, open the markdown preview and search for `codex` Zed Nightly will completely freeze. After this optimisation it is totally smooth even in debug mode. Release Notes: - Improved performance when searching in markdown preview
4 files changedLine totals unavailable