From 74a9dd51ffb7cd3c14d4c7b5502e4febad24caa0 Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Fri, 4 Mar 2022 06:05:21 +0530 Subject: Fallback to broader scope if theme scope not found (#1714) --- helix-view/src/theme.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'helix-view/src') diff --git a/helix-view/src/theme.rs b/helix-view/src/theme.rs index 00c1bbbd..3f45aac6 100644 --- a/helix-view/src/theme.rs +++ b/helix-view/src/theme.rs @@ -153,8 +153,12 @@ impl Theme { self.try_get(scope).unwrap_or_default() } + /// Get the style of a scope, falling back to dot separated broader + /// scopes. For example if `ui.text.focus` is not defined in the theme, + /// `ui.text` is tried and then `ui` is tried. pub fn try_get(&self, scope: &str) -> Option