Skip to content

Commit

Permalink
reload config whenever returning to gui
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseduffield committed Feb 24, 2021
1 parent a62d70f commit 043cb2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/config/app_config.go
Expand Up @@ -41,6 +41,7 @@ type AppConfigurer interface {
SaveAppState() error
SetIsNewRepo(bool)
GetIsNewRepo() bool
ReloadUserConfig() error
}

// NewAppConfig makes a new app config
Expand Down Expand Up @@ -203,6 +204,16 @@ func (c *AppConfig) GetUserConfigDir() string {
return c.UserConfigDir
}

func (c *AppConfig) ReloadUserConfig() error {
userConfig, err := loadUserConfigWithDefaults(c.UserConfigDir)
if err != nil {
return err
}

c.UserConfig = userConfig
return nil
}

func configFilePath(filename string) (string, error) {
folder, err := findOrCreateConfigDir()
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions pkg/gui/gui.go
Expand Up @@ -464,6 +464,9 @@ func (gui *Gui) Run() error {
}

g.OnSearchEscape = gui.onSearchEscape
if err := gui.Config.ReloadUserConfig(); err != nil {
return nil
}
userConfig := gui.Config.GetUserConfig()
g.SearchEscapeKey = gui.getKey(userConfig.Keybinding.Universal.Return)
g.NextSearchMatchKey = gui.getKey(userConfig.Keybinding.Universal.NextMatch)
Expand Down

0 comments on commit 043cb2e

Please sign in to comment.