1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

more refactoring

This commit is contained in:
Jesse Duffield
2021-04-05 01:10:23 +10:00
parent 952c62df37
commit d627b3bfc8
7 changed files with 203 additions and 204 deletions

View File

@ -117,14 +117,14 @@ func (gui *Gui) refreshFilesAndSubmodules() error {
gui.Log.Error(err)
}
if gui.Views.Files.Context == FILES_CONTEXT_KEY {
if ContextKey(gui.Views.Files.Context) == FILES_CONTEXT_KEY {
// doing this a little custom (as opposed to using gui.postRefreshUpdate) because we handle selecting the file explicitly below
if err := gui.State.Contexts.Files.HandleRender(); err != nil {
return err
}
}
if gui.currentContext().GetKey() == FILES_CONTEXT_KEY || (g.CurrentView() == gui.Views.Main && g.CurrentView().Context == MAIN_MERGING_CONTEXT_KEY) {
if gui.currentContext().GetKey() == FILES_CONTEXT_KEY || (g.CurrentView() == gui.Views.Main && ContextKey(g.CurrentView().Context) == MAIN_MERGING_CONTEXT_KEY) {
newSelectedPath := gui.getSelectedPath()
alreadySelected := selectedPath != "" && newSelectedPath == selectedPath
if err := gui.selectFile(alreadySelected); err != nil {
@ -856,7 +856,7 @@ func (gui *Gui) handleToggleFileTreeView() error {
}
}
if gui.Views.Files.Context == FILES_CONTEXT_KEY {
if ContextKey(gui.Views.Files.Context) == FILES_CONTEXT_KEY {
if err := gui.State.Contexts.Files.HandleRender(); err != nil {
return err
}