mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-25 18:07:07 +09:00
settings: Don't return maps with ParsedSettings()
Map-typed values in the parsedSettings map do not represent settings for individual options, they represent maps of settings for multiple options for the given glob or ft: pattern, and their keys are not option names, they are glob and ft: patterns. So do not expose them to the callers of ParsedSettings(), to prevent the callers from mistakenly treating those patterns as option names, with unpredicted consequences. Co-authored-by: Dmytro Maluka <dmitrymaluka@gmail.com>
This commit is contained in:
@@ -256,6 +256,9 @@ func ReadSettings() error {
|
|||||||
func ParsedSettings() map[string]any {
|
func ParsedSettings() map[string]any {
|
||||||
s := make(map[string]any)
|
s := make(map[string]any)
|
||||||
for k, v := range parsedSettings {
|
for k, v := range parsedSettings {
|
||||||
|
if strings.HasPrefix(reflect.TypeOf(v).String(), "map") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
s[k] = v
|
s[k] = v
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
|
|||||||
Reference in New Issue
Block a user