Skip to content

Commit

Permalink
Fallback to linenr if linenr.selected is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
sudormrfbin committed Jun 14, 2021
1 parent 9701a19 commit 63b11ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion helix-term/src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ impl EditorView {
}

// render selections and selected linenr(s)
let linenr_select: Style = theme.get("ui.linenr.selected");
let linenr_select: Style = theme
.try_get("ui.linenr.selected")
.unwrap_or(theme.get("ui.linenr"));

if is_focused {
let screen = {
Expand Down
8 changes: 5 additions & 3 deletions helix-view/src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,14 @@ fn parse_modifier(value: &Value) -> Option<Modifier> {

impl Theme {
pub fn get(&self, scope: &str) -> Style {
self.styles
.get(scope)
.copied()
self.try_get(scope)
.unwrap_or_else(|| Style::default().fg(Color::Rgb(0, 0, 255)))
}

pub fn try_get(&self, scope: &str) -> Option<Style> {
self.styles.get(scope).copied()
}

#[inline]
pub fn scopes(&self) -> &[String] {
&self.scopes
Expand Down

0 comments on commit 63b11ac

Please sign in to comment.