diff options
-rw-r--r-- | pkg/gui/branches_panel.go | 2 | ||||
-rw-r--r-- | pkg/gui/commit_files_panel.go | 10 | ||||
-rw-r--r-- | pkg/gui/commits_panel.go | 26 | ||||
-rw-r--r-- | pkg/gui/patch_building_panel.go | 19 | ||||
-rw-r--r-- | pkg/gui/stash_panel.go | 2 | ||||
-rw-r--r-- | pkg/gui/status_panel.go | 2 |
6 files changed, 38 insertions, 23 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index ce9ac4daa..fef122886 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -25,6 +25,8 @@ func (gui *Gui) handleBranchSelect(g *gocui.Gui, v *gocui.View) error { return nil } + gui.State.SplitMainPanel = false + if _, err := gui.g.SetCurrentView(v.Name()); err != nil { return err } diff --git a/pkg/gui/commit_files_panel.go b/pkg/gui/commit_files_panel.go index d6350ce18..e0e8f84dd 100644 --- a/pkg/gui/commit_files_panel.go +++ b/pkg/gui/commit_files_panel.go @@ -16,11 +16,19 @@ func (gui *Gui) getSelectedCommitFile(g *gocui.Gui) *commands.CommitFile { } func (gui *Gui) handleCommitFileSelect(g *gocui.Gui, v *gocui.View) error { + if gui.popupPanelFocused() { + return nil + } + commitFile := gui.getSelectedCommitFile(g) if commitFile == nil { return gui.renderString(g, "commitFiles", gui.Tr.SLocalize("NoCommiteFiles")) } + if err := gui.refreshSecondaryPatchPanel(); err != nil { + return err + } + if err := gui.focusPoint(0, gui.State.Panels.CommitFiles.SelectedLine, len(gui.State.CommitFiles), v); err != nil { return err } @@ -84,7 +92,7 @@ func (gui *Gui) handleDiscardOldFileChange(g *gocui.Gui, v *gocui.View) error { } func (gui *Gui) refreshCommitFilesView() error { - if err := gui.refreshPatchPanel(); err != nil { + if err := gui.refreshSecondaryPatchPanel(); err != nil { return err } diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 667b6b54f..ca15d9401 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -28,6 +28,11 @@ func (gui *Gui) handleCommitSelect(g *gocui.Gui, v *gocui.View) error { return nil } + // this probably belongs in an 'onFocus' function than a 'commit selected' function + if err := gui.refreshSecondaryPatchPanel(); err != nil { + return err + } + if _, err := gui.g.SetCurrentView(v.Name()); err != nil { return err } @@ -52,23 +57,6 @@ func (gui *Gui) handleCommitSelect(g *gocui.Gui, v *gocui.View) error { return gui.renderString(g, "main", commitText) } -func (gui *Gui) refreshPatchPanel() error { - if gui.GitCommand.PatchManager != nil { - gui.State.SplitMainPanel = true - secondaryView := gui.getSecondaryView() - secondaryView.Highlight = true - secondaryView.Wrap = false - - gui.g.Update(func(*gocui.Gui) error { - return gui.setViewContent(gui.g, gui.getSecondaryView(), gui.GitCommand.PatchManager.RenderAggregatedPatchColored(false)) - }) - } else { - gui.State.SplitMainPanel = false - } - - return nil -} - func (gui *Gui) refreshCommits(g *gocui.Gui) error { g.Update(func(*gocui.Gui) error { builder, err := commands.NewCommitListBuilder(gui.Log, gui.GitCommand, gui.OSCommand, gui.Tr, gui.State.CherryPickedCommits, gui.State.DiffEntries) @@ -81,10 +69,6 @@ func (gui *Gui) refreshCommits(g *gocui.Gui) error { } gui.State.Commits = commits - if err := gui.refreshPatchPanel(); err != nil { - return err - } - gui.refreshSelectedLine(&gui.State.Panels.Commits.SelectedLine, len(gui.State.Commits)) isFocused := gui.g.CurrentView().Name() == "commits" diff --git a/pkg/gui/patch_building_panel.go b/pkg/gui/patch_building_panel.go index cc16111b7..863e464fe 100644 --- a/pkg/gui/patch_building_panel.go +++ b/pkg/gui/patch_building_panel.go @@ -31,7 +31,7 @@ func (gui *Gui) refreshPatchBuildingPanel() error { } if empty { - return gui.handleStagingEscape(gui.g, nil) + return gui.handleEscapePatchBuildingPanel(gui.g, nil) } return nil @@ -86,3 +86,20 @@ func (gui *Gui) handleEscapePatchBuildingPanel(g *gocui.Gui, v *gocui.View) erro return gui.switchFocus(gui.g, nil, gui.getCommitFilesView()) } + +func (gui *Gui) refreshSecondaryPatchPanel() error { + if gui.GitCommand.PatchManager != nil { + gui.State.SplitMainPanel = true + secondaryView := gui.getSecondaryView() + secondaryView.Highlight = true + secondaryView.Wrap = false + + gui.g.Update(func(*gocui.Gui) error { + return gui.setViewContent(gui.g, gui.getSecondaryView(), gui.GitCommand.PatchManager.RenderAggregatedPatchColored(false)) + }) + } else { + gui.State.SplitMainPanel = false + } + + return nil +} diff --git a/pkg/gui/stash_panel.go b/pkg/gui/stash_panel.go index 4a2b463ce..7397bf847 100644 --- a/pkg/gui/stash_panel.go +++ b/pkg/gui/stash_panel.go @@ -24,6 +24,8 @@ func (gui *Gui) handleStashEntrySelect(g *gocui.Gui, v *gocui.View) error { return nil } + gui.State.SplitMainPanel = false + if _, err := gui.g.SetCurrentView(v.Name()); err != nil { return err } diff --git a/pkg/gui/status_panel.go b/pkg/gui/status_panel.go index de1823a44..ff558f82d 100644 --- a/pkg/gui/status_panel.go +++ b/pkg/gui/status_panel.go @@ -52,6 +52,8 @@ func (gui *Gui) handleStatusSelect(g *gocui.Gui, v *gocui.View) error { return nil } + gui.State.SplitMainPanel = false + if _, err := gui.g.SetCurrentView(v.Name()); err != nil { return err } |