Add reset command and statusline format string options

This commit is contained in:
Zachary Yedidia
2019-06-16 17:35:00 -04:00
parent 8d85cae4c0
commit 809b95d290
8 changed files with 88 additions and 81 deletions

View File

@@ -5,17 +5,7 @@ import (
"github.com/zyedidia/micro/internal/screen"
)
// SetOption sets a given option to a value just for this buffer
func (b *Buffer) SetOption(option, value string) error {
if _, ok := b.Settings[option]; !ok {
return config.ErrInvalidOption
}
nativeValue, err := config.GetNativeValue(option, b.Settings[option], value)
if err != nil {
return err
}
func (b *Buffer) SetOptionNative(option string, nativeValue interface{}) error {
b.Settings[option] = nativeValue
if option == "fastdirty" {
@@ -45,9 +35,21 @@ func (b *Buffer) SetOption(option, value string) error {
}
} else if option == "encoding" {
b.isModified = true
} else if option == "hidehelp" {
b.SetStatusFormat()
}
return nil
}
// SetOption sets a given option to a value just for this buffer
func (b *Buffer) SetOption(option, value string) error {
if _, ok := b.Settings[option]; !ok {
return config.ErrInvalidOption
}
nativeValue, err := config.GetNativeValue(option, b.Settings[option], value)
if err != nil {
return err
}
return b.SetOptionNative(option, nativeValue)
}