Disable early validation of colorscheme option

Adding early validation of options in ReadSettings() caused a regression:
colorschemes registered by plugins via config.AddRuntimeFile() stopped
working, since ReadSettings() is called when plugins are not initialized
(or even loaded) yet, so a colorscheme is not registered yet and thus
its validation fails.

Fix that with an ad-hoc fix: treat the "colorscheme" option as a special
case and do not verify it early when reading settings.json, postponing
that until the moment when we try to load this colorscheme.
This commit is contained in:
Dmytro Maluka
2025-05-25 16:33:41 +02:00
parent bf255b6c35
commit 73066fb69b
2 changed files with 14 additions and 0 deletions

View File

@@ -55,6 +55,14 @@ func InitColorscheme() error {
c, err := LoadDefaultColorscheme()
if err == nil {
Colorscheme = c
} else {
// The colorscheme setting seems broken (maybe because we have not validated
// it earlier, see comment in verifySetting()). So reset it to the default
// colorscheme and try again.
GlobalSettings["colorscheme"] = DefaultGlobalOnlySettings["colorscheme"]
if c, err2 := LoadDefaultColorscheme(); err2 == nil {
Colorscheme = c
}
}
return err