mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 12:55:47 +02:00
Remove return value of RefreshPatchBuildingPanel
This commit is contained in:
parent
371998e635
commit
6f0182f11c
3 changed files with 7 additions and 11 deletions
|
@ -55,7 +55,7 @@ func (self *PatchBuildingHelper) Reset() error {
|
||||||
return self.c.PostRefreshUpdate(self.c.Context().Current())
|
return self.c.PostRefreshUpdate(self.c.Context().Current())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *PatchBuildingHelper) RefreshPatchBuildingPanel(opts types.OnFocusOpts) error {
|
func (self *PatchBuildingHelper) RefreshPatchBuildingPanel(opts types.OnFocusOpts) {
|
||||||
selectedLineIdx := -1
|
selectedLineIdx := -1
|
||||||
if opts.ClickedWindowName == "main" {
|
if opts.ClickedWindowName == "main" {
|
||||||
selectedLineIdx = opts.ClickedViewLineIdx
|
selectedLineIdx = opts.ClickedViewLineIdx
|
||||||
|
@ -63,20 +63,20 @@ func (self *PatchBuildingHelper) RefreshPatchBuildingPanel(opts types.OnFocusOpt
|
||||||
|
|
||||||
if !self.c.Git().Patch.PatchBuilder.Active() {
|
if !self.c.Git().Patch.PatchBuilder.Active() {
|
||||||
self.Escape()
|
self.Escape()
|
||||||
return nil
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// get diff from commit file that's currently selected
|
// get diff from commit file that's currently selected
|
||||||
path := self.c.Contexts().CommitFiles.GetSelectedPath()
|
path := self.c.Contexts().CommitFiles.GetSelectedPath()
|
||||||
if path == "" {
|
if path == "" {
|
||||||
return nil
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
from, to := self.c.Contexts().CommitFiles.GetFromAndToForDiff()
|
from, to := self.c.Contexts().CommitFiles.GetFromAndToForDiff()
|
||||||
from, reverse := self.c.Modes().Diffing.GetFromAndReverseArgsForDiff(from)
|
from, reverse := self.c.Modes().Diffing.GetFromAndReverseArgsForDiff(from)
|
||||||
diff, err := self.c.Git().WorkingTree.ShowFileDiff(from, to, reverse, path, true)
|
diff, err := self.c.Git().WorkingTree.ShowFileDiff(from, to, reverse, path, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
secondaryDiff := self.c.Git().Patch.PatchBuilder.RenderPatchForFile(patch.RenderPatchForFileOpts{
|
secondaryDiff := self.c.Git().Patch.PatchBuilder.RenderPatchForFile(patch.RenderPatchForFileOpts{
|
||||||
|
@ -94,7 +94,7 @@ func (self *PatchBuildingHelper) RefreshPatchBuildingPanel(opts types.OnFocusOpt
|
||||||
context.SetState(state)
|
context.SetState(state)
|
||||||
if state == nil {
|
if state == nil {
|
||||||
self.Escape()
|
self.Escape()
|
||||||
return nil
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
mainContent := context.GetContentToRender(true)
|
mainContent := context.GetContentToRender(true)
|
||||||
|
@ -112,6 +112,4 @@ func (self *PatchBuildingHelper) RefreshPatchBuildingPanel(opts types.OnFocusOpt
|
||||||
Title: self.c.Tr.CustomPatch,
|
Title: self.c.Tr.CustomPatch,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,7 @@ func (self *RefreshHelper) Refresh(options types.RefreshOptions) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if scopeSet.Includes(types.PATCH_BUILDING) {
|
if scopeSet.Includes(types.PATCH_BUILDING) {
|
||||||
refresh("patch building", func() { _ = self.patchBuildingHelper.RefreshPatchBuildingPanel(types.OnFocusOpts{}) })
|
refresh("patch building", func() { self.patchBuildingHelper.RefreshPatchBuildingPanel(types.OnFocusOpts{}) })
|
||||||
}
|
}
|
||||||
|
|
||||||
if scopeSet.Includes(types.MERGE_CONFLICTS) || scopeSet.Includes(types.FILES) {
|
if scopeSet.Includes(types.MERGE_CONFLICTS) || scopeSet.Includes(types.FILES) {
|
||||||
|
|
|
@ -67,9 +67,7 @@ func (self *PatchBuildingController) GetOnFocus() func(types.OnFocusOpts) {
|
||||||
// no need to change wrap on the secondary view because it can't be interacted with
|
// no need to change wrap on the secondary view because it can't be interacted with
|
||||||
self.c.Views().PatchBuilding.Wrap = false
|
self.c.Views().PatchBuilding.Wrap = false
|
||||||
|
|
||||||
// Swallowing the error here for now. This will change shortly to not
|
self.c.Helpers().PatchBuilding.RefreshPatchBuildingPanel(opts)
|
||||||
// return an error any more.
|
|
||||||
_ = self.c.Helpers().PatchBuilding.RefreshPatchBuildingPanel(opts) // FIXME
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue