mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-16 05:47:06 +09:00
Merge pull request #3761 from dmaluka/colorscheme-plugins-regression-fix
Fix non-working colorscheme plugins
This commit is contained in:
@@ -374,11 +374,6 @@ func main() {
|
|||||||
action.InitBindings()
|
action.InitBindings()
|
||||||
action.InitCommands()
|
action.InitCommands()
|
||||||
|
|
||||||
err = config.InitColorscheme()
|
|
||||||
if err != nil {
|
|
||||||
screen.TermMessage(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = config.RunPluginFn("preinit")
|
err = config.RunPluginFn("preinit")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
screen.TermMessage(err)
|
screen.TermMessage(err)
|
||||||
@@ -407,6 +402,11 @@ func main() {
|
|||||||
screen.TermMessage(err)
|
screen.TermMessage(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = config.InitColorscheme()
|
||||||
|
if err != nil {
|
||||||
|
screen.TermMessage(err)
|
||||||
|
}
|
||||||
|
|
||||||
if clipErr != nil {
|
if clipErr != nil {
|
||||||
log.Println(clipErr, " or change 'clipboard' option")
|
log.Println(clipErr, " or change 'clipboard' option")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,14 @@ func InitColorscheme() error {
|
|||||||
c, err := LoadDefaultColorscheme()
|
c, err := LoadDefaultColorscheme()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
Colorscheme = c
|
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
|
return err
|
||||||
|
|||||||
@@ -273,6 +273,12 @@ func verifySetting(option string, value interface{}, def interface{}) error {
|
|||||||
return fmt.Errorf("Error: setting '%s' has incorrect type (%s), using default value: %v (%s)", option, valType, def, defType)
|
return fmt.Errorf("Error: setting '%s' has incorrect type (%s), using default value: %v (%s)", option, valType, def, defType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if option == "colorscheme" {
|
||||||
|
// Plugins are not initialized yet, so do not verify if the colorscheme
|
||||||
|
// exists yet, since the colorscheme may be added by a plugin later.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if err := OptionIsValid(option, value); err != nil {
|
if err := OptionIsValid(option, value); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user