Skip to content

Commit

Permalink
Performance and simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
TobTobXX committed Jun 20, 2022
1 parent 9eb6f46 commit 7e92040
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions helix-term/src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
}
}
}
Expand Down

0 comments on commit 7e92040

Please sign in to comment.