Transparently set sampleConfig.Separator.{Left,Right}.FontSize to sampleConfig.FontSize if it is not defined in config

This commit is contained in:
eleksir
2024-09-27 21:07:23 +03:00
parent e485ca02d9
commit 40eaac419d

View File

@@ -361,6 +361,10 @@ func ReadConf(DefaultConfig []byte) (*MyConfig, error) {
sampleConfig.Separator.Left.Font = sampleConfig.Font
}
if sampleConfig.Separator.Left.FontSize == "" {
sampleConfig.Separator.Left.FontSize = sampleConfig.FontSize
}
matched, err := regexp.MatchString(
`^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
sampleConfig.Separator.Left.FontSize,
@@ -403,6 +407,10 @@ func ReadConf(DefaultConfig []byte) (*MyConfig, error) {
sampleConfig.Separator.Right.Font = sampleConfig.Font
}
if sampleConfig.Separator.Right.FontSize == "" {
sampleConfig.Separator.Right.FontSize = sampleConfig.FontSize
}
matched, err = regexp.MatchString(
`^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
sampleConfig.Separator.Right.FontSize,