aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-11-22 02:26:16 +0000
committerBlaž Hrastnik2021-11-22 02:26:16 +0000
commit28fd704bce2fec56e46991b26eed5a17e519e6bd (patch)
treed2f90f511a92468cd0ad945afe143a911c719249 /helix-term
parentb55ca8fdb843972ee11f73e9e32b966541da4ba8 (diff)
ui: Since diagnostics are sorted, we can use binary search
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/ui/editor.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 19f0243e..de2281c6 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -482,7 +482,8 @@ impl EditorView {
for (i, line) in (view.offset.row..(last_line + 1)).enumerate() {
use helix_core::diagnostic::Severity;
- if let Some(diagnostic) = doc.diagnostics().iter().find(|d| d.line == line) {
+ if let Ok(diagnostic) = doc.diagnostics().binary_search_by_key(&line, |d| d.line) {
+ let diagnostic = &doc.diagnostics()[diagnostic];
surface.set_stringn(
viewport.x,
viewport.y + i as u16,