mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-18 23:05:40 -04:00
buffer/settings: On filetype
change reload parsed local settings only
Additionally keep volatile settings as they have been set by the user.
This commit is contained in:
parent
62c1c667b8
commit
521b63a28c
@ -26,7 +26,23 @@ func (b *Buffer) SetOptionNative(option string, nativeValue interface{}) error {
|
|||||||
} else if option == "statusline" {
|
} else if option == "statusline" {
|
||||||
screen.Redraw()
|
screen.Redraw()
|
||||||
} else if option == "filetype" {
|
} else if option == "filetype" {
|
||||||
config.InitLocalSettings(b.Settings, b.Path)
|
settings := config.ParsedSettings()
|
||||||
|
settings["filetype"] = nativeValue
|
||||||
|
config.InitLocalSettings(settings, b.Path)
|
||||||
|
for k, v := range config.DefaultCommonSettings() {
|
||||||
|
if k == "filetype" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if _, ok := config.VolatileSettings[k]; ok {
|
||||||
|
// filetype should not override volatile settings
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if _, ok := settings[k]; ok {
|
||||||
|
b.SetOptionNative(k, settings[k])
|
||||||
|
} else {
|
||||||
|
b.SetOptionNative(k, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
b.UpdateRules()
|
b.UpdateRules()
|
||||||
} else if option == "fileformat" {
|
} else if option == "fileformat" {
|
||||||
switch b.Settings["fileformat"].(string) {
|
switch b.Settings["fileformat"].(string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user