From 7e92040d4962bc5327a71adaac0676c33ccc973f Mon Sep 17 00:00:00 2001 From: TobTobXX Date: Mon, 20 Jun 2022 10:36:21 +0200 Subject: [PATCH] Performance and simplification --- helix-term/src/ui/editor.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 24046f8b90779..09f6ec25e180b 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -674,6 +674,9 @@ impl EditorView { .map(|range| range.cursor_line(text)) .collect(); + let primary_style = theme.get("ui.cursorline.primary"); + let secondary_style = theme.get("ui.cursorline.secondary"); + for line in view.offset.row..(last_line + 1) { let area = Rect::new( view.area.x, @@ -682,15 +685,9 @@ impl EditorView { 1, ); if primary_line == line { - let style = theme - .try_get("ui.cursorline.primary") - .unwrap_or_else(|| theme.get("ui.cursorline")); - surface.set_style(area, style); + surface.set_style(area, primary_style); } else if secondary_lines.contains(&line) { - let style = theme - .try_get("ui.cursorline.secondary") - .unwrap_or_else(|| theme.get("ui.cursorline")); - surface.set_style(area, style); + surface.set_style(area, secondary_style); } } }