mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-12 08:36:25 -04:00
Wire the remaining diff panels — local commits, sub-commits, commit files, stash, and reflog — into the focused main view's raw-diff fallback, the same way the files panel already is: each computes DiffMainViewShouldRenderRaw and renders its diff raw (no pager) when focused under a pager whose output we can't resolve, so its selection stays toggleable into a custom patch (or, for reflog, navigable and copyable). The commit-diff panels build their diff through the diff helper, which can't reach the staging helper, so the panel computes renderRaw and passes it in. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
64 lines
1.6 KiB
Go
64 lines
1.6 KiB
Go
package controllers
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
|
)
|
|
|
|
type ReflogCommitsController struct {
|
|
baseController
|
|
*ListControllerTrait[*models.Commit]
|
|
c *ControllerCommon
|
|
}
|
|
|
|
var _ types.IController = &ReflogCommitsController{}
|
|
|
|
func NewReflogCommitsController(
|
|
c *ControllerCommon,
|
|
) *ReflogCommitsController {
|
|
return &ReflogCommitsController{
|
|
baseController: baseController{},
|
|
ListControllerTrait: NewListControllerTrait(
|
|
c,
|
|
c.Contexts().ReflogCommits,
|
|
c.Contexts().ReflogCommits.GetSelected,
|
|
c.Contexts().ReflogCommits.GetSelectedItems,
|
|
),
|
|
c: c,
|
|
}
|
|
}
|
|
|
|
func (self *ReflogCommitsController) Context() types.Context {
|
|
return self.context()
|
|
}
|
|
|
|
func (self *ReflogCommitsController) context() *context.ReflogCommitsContext {
|
|
return self.c.Contexts().ReflogCommits
|
|
}
|
|
|
|
func (self *ReflogCommitsController) GetOnRenderToMain() func() {
|
|
return func() {
|
|
self.c.Helpers().Diff.WithDiffModeCheck(func() {
|
|
commit := self.context().GetSelected()
|
|
var task types.UpdateTask
|
|
if commit == nil {
|
|
task = types.NewRenderStringTask("No reflog history")
|
|
} else {
|
|
renderRaw := self.c.Helpers().Staging.DiffMainViewShouldRenderRaw()
|
|
cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Hash(), self.c.Helpers().Diff.FilterPathsForCommit(commit), renderRaw)
|
|
|
|
task = types.NewMainViewDiffTask(renderRaw, cmdObj.GetCmd())
|
|
}
|
|
|
|
self.c.RenderToMainViews(types.RefreshMainOpts{
|
|
Pair: self.c.MainViewPairs().Normal,
|
|
Main: &types.ViewUpdateOpts{
|
|
Title: "Reflog Entry",
|
|
Task: task,
|
|
},
|
|
})
|
|
})
|
|
}
|
|
}
|