refactor: use a more modern writing style to simplify code (#3834)

Signed-off-by: deepdring <deepdrink@icloud.com>
This commit is contained in:
deepdring
2025-08-26 08:00:51 +08:00
committed by GitHub
parent 094b02da4c
commit b8057f28c6
24 changed files with 98 additions and 100 deletions

View File

@@ -96,7 +96,7 @@ func NewStatusLine(win *BufWindow) *StatusLine {
}
// FindOpt finds a given option in the current buffer's settings
func (s *StatusLine) FindOpt(opt string) interface{} {
func (s *StatusLine) FindOpt(opt string) any {
if val, ok := s.win.Buf.Settings[opt]; ok {
return val
}
@@ -152,7 +152,7 @@ func (s *StatusLine) Display() {
name := match[2 : len(match)-1]
if bytes.HasPrefix(name, []byte("opt")) {
option := name[4:]
return []byte(fmt.Sprint(s.FindOpt(string(option))))
return fmt.Append(nil, s.FindOpt(string(option)))
} else if bytes.HasPrefix(name, []byte("bind")) {
binding := string(name[5:])
for k, v := range config.Bindings["buffer"] {