style - amend reset style on apply

This commit is contained in:
Mahdi Abu Yasmine 2023-11-05 14:33:47 +01:00
parent a910f3e175
commit cc5e55b010

View File

@ -2,6 +2,7 @@ package style
import (
"fmt"
"sort"
"strings"
"gitea.meta-tech.academy/go/core/util"
@ -138,8 +139,13 @@ func (s *Styles) Keyval(key string, val string, names ...string) {
}
func (s *Styles) Render() {
for name, style := range s.List {
style.Echof(" %s", name)
keys := make([]string, 0, len(s.List))
for name := range s.List {
keys = append(keys, name)
}
sort.Strings(keys)
for _, name := range keys {
s.Get(name).Echof(" %s", name)
defStyle.Ln()
}
}