mirror of https://github.com/helix-editor/helix
make sure arbitrary keys can be added to themes after construction
parent
7cbde094c4
commit
4eb2587177
|
@ -317,13 +317,16 @@ impl Theme {
|
|||
}
|
||||
|
||||
pub fn set(&mut self, scope: String, style: Style) {
|
||||
self.styles.insert(scope.to_string(), style);
|
||||
|
||||
if self.styles.insert(scope.to_string(), style).is_some() {
|
||||
for (name, highlights) in self.scopes.iter().zip(self.highlights.iter_mut()) {
|
||||
if *name == scope {
|
||||
*highlights = style;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self.scopes.push(scope);
|
||||
self.highlights.push(style);
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the style of a scope, falling back to dot separated broader
|
||||
|
|
Loading…
Reference in New Issue