mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 20:36:03 +02:00
Reload changed user config files on terminal focus
This commit is contained in:
parent
18ad975573
commit
ce50533689
2 changed files with 53 additions and 5 deletions
|
@ -331,8 +331,23 @@ func (gui *Gui) onNewRepo(startArgs appTypes.StartArgs, contextKey types.Context
|
|||
|
||||
gui.g.SetFocusHandler(func(Focused bool) error {
|
||||
if Focused {
|
||||
reloadErr, didChange := gui.Config.ReloadChangedUserConfigFiles()
|
||||
if didChange && reloadErr == nil {
|
||||
gui.c.Log.Info("User config changed - reloading")
|
||||
reloadErr = gui.onUserConfigLoaded()
|
||||
if err := gui.resetKeybindings(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
gui.c.Log.Info("Receiving focus - refreshing")
|
||||
return gui.helpers.Refresh.Refresh(types.RefreshOptions{Mode: types.ASYNC})
|
||||
refreshErr := gui.helpers.Refresh.Refresh(types.RefreshOptions{Mode: types.ASYNC})
|
||||
if reloadErr != nil {
|
||||
// An error from reloading the config is the more important one
|
||||
// to report to the user
|
||||
return reloadErr
|
||||
}
|
||||
return refreshErr
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue