mirror of https://github.com/helix-editor/helix
make sure arbitrary keys can be added to themes after construction
parent
7cbde094c4
commit
4eb2587177
|
@ -317,12 +317,15 @@ impl Theme {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set(&mut self, scope: String, style: Style) {
|
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()) {
|
||||||
for (name, highlights) in self.scopes.iter().zip(self.highlights.iter_mut()) {
|
if *name == scope {
|
||||||
if *name == scope {
|
*highlights = style;
|
||||||
*highlights = style;
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
self.scopes.push(scope);
|
||||||
|
self.highlights.push(style);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue