on master help sign in
ui: Since diagnostics are sorted, we can use binary search
28fd704Blaž Hrastnik
helix-term/src/ui/editor.rs+2−1
@@ -482,7 +482,8 @@ impl EditorView {
482
482
483 for (i, line) in (view.offset.row..(last_line + 1)).enumerate() {
483 for (i, line) in (view.offset.row..(last_line + 1)).enumerate() {
484 use helix_core::diagnostic::Severity;
484 use helix_core::diagnostic::Severity;
485− if let Some(diagnostic) = doc.diagnostics().iter().find(|d| d.line == line) {
485+ if let Ok(diagnostic) = doc.diagnostics().binary_search_by_key(&line, |d| d.line) {
486+ let diagnostic = &doc.diagnostics()[diagnostic];
486 surface.set_stringn(
487 surface.set_stringn(
487 viewport.x,
488 viewport.x,
488 viewport.y + i as u16,
489 viewport.y + i as u16,