buffer: Fix ReloadSettings(true) for volatile filetype

We shall not overwrite a volatile set `filetype` provided as argument for micro:
`micro -filetype shell foo`
This commit is contained in:
Jöran Karl 2025-02-12 21:25:10 +01:00
parent 5a62a8ead4
commit 00e568640c

View File

@ -13,7 +13,9 @@ import (
func (b *Buffer) ReloadSettings(reloadFiletype bool) { func (b *Buffer) ReloadSettings(reloadFiletype bool) {
settings := config.ParsedSettings() settings := config.ParsedSettings()
if _, ok := b.LocalSettings["filetype"]; !ok && reloadFiletype { _, local := b.LocalSettings["filetype"]
_, volatile := config.VolatileSettings["filetype"]
if reloadFiletype && !local && !volatile {
// need to update filetype before updating other settings based on it // need to update filetype before updating other settings based on it
b.Settings["filetype"] = "unknown" b.Settings["filetype"] = "unknown"
if v, ok := settings["filetype"]; ok { if v, ok := settings["filetype"]; ok {