1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

support viewing commits of reflog entry and show better view title

This commit is contained in:
Jesse Duffield
2022-03-24 22:07:30 +11:00
parent e039429885
commit 13b90ac37f
21 changed files with 177 additions and 54 deletions

View File

@ -39,24 +39,20 @@ func (gui *Gui) commitFilesRenderToMain() error {
}
func (gui *Gui) SwitchToCommitFilesContext(opts controllers.SwitchToCommitFilesContextOpts) error {
// sometimes the commitFiles view is already shown in another window, so we need to ensure that window
// no longer considers the commitFiles view as its main view.
gui.resetWindowContext(gui.State.Contexts.CommitFiles)
gui.State.Contexts.CommitFiles.SetSelectedLineIdx(0)
gui.State.Contexts.CommitFiles.SetRefName(opts.RefName)
gui.State.Contexts.CommitFiles.SetCanRebase(opts.CanRebase)
gui.State.Contexts.CommitFiles.SetParentContext(opts.Context)
gui.State.Contexts.CommitFiles.SetWindowName(opts.Context.GetWindowName())
if err := gui.refreshCommitFilesView(); err != nil {
if err := gui.refreshCommitFilesContext(); err != nil {
return err
}
return gui.c.PushContext(gui.State.Contexts.CommitFiles)
}
func (gui *Gui) refreshCommitFilesView() error {
func (gui *Gui) refreshCommitFilesContext() error {
currentSideContext := gui.currentSideContext()
if currentSideContext.GetKey() == context.COMMIT_FILES_CONTEXT_KEY || currentSideContext.GetKey() == context.LOCAL_COMMITS_CONTEXT_KEY {
if err := gui.handleRefreshPatchBuildingPanel(-1); err != nil {