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

Remove return value of IPatchExplorerContext.Render, RenderAndFocus, and NavigateTo

This commit is contained in:
Stefan Haller 2024-09-04 13:57:01 +02:00
parent 5446683881
commit 8edcd71234
6 changed files with 16 additions and 19 deletions

View File

@ -68,13 +68,11 @@ func (self *MergeConflictsContext) IsUserScrolling() bool {
return self.viewModel.userVerticalScrolling return self.viewModel.userVerticalScrolling
} }
func (self *MergeConflictsContext) RenderAndFocus() error { func (self *MergeConflictsContext) RenderAndFocus() {
self.setContent() self.setContent()
self.FocusSelection() self.FocusSelection()
self.c.Render() self.c.Render()
return nil
} }
func (self *MergeConflictsContext) Render() error { func (self *MergeConflictsContext) Render() error {

View File

@ -53,7 +53,8 @@ func NewPatchExplorerContext(
func(selectedLineIdx int) error { func(selectedLineIdx int) error {
ctx.GetMutex().Lock() ctx.GetMutex().Lock()
defer ctx.GetMutex().Unlock() defer ctx.GetMutex().Unlock()
return ctx.NavigateTo(ctx.c.Context().IsCurrent(ctx), selectedLineIdx) ctx.NavigateTo(ctx.c.Context().IsCurrent(ctx), selectedLineIdx)
return nil
}), }),
) )
@ -78,21 +79,17 @@ func (self *PatchExplorerContext) GetIncludedLineIndices() []int {
return self.getIncludedLineIndices() return self.getIncludedLineIndices()
} }
func (self *PatchExplorerContext) RenderAndFocus(isFocused bool) error { func (self *PatchExplorerContext) RenderAndFocus(isFocused bool) {
self.setContent(isFocused) self.setContent(isFocused)
self.FocusSelection() self.FocusSelection()
self.c.Render() self.c.Render()
return nil
} }
func (self *PatchExplorerContext) Render(isFocused bool) error { func (self *PatchExplorerContext) Render(isFocused bool) {
self.setContent(isFocused) self.setContent(isFocused)
self.c.Render() self.c.Render()
return nil
} }
func (self *PatchExplorerContext) Focus() error { func (self *PatchExplorerContext) Focus() error {
@ -132,11 +129,11 @@ func (self *PatchExplorerContext) GetContentToRender(isFocused bool) string {
return self.GetState().RenderForLineIndices(isFocused, self.GetIncludedLineIndices()) return self.GetState().RenderForLineIndices(isFocused, self.GetIncludedLineIndices())
} }
func (self *PatchExplorerContext) NavigateTo(isFocused bool, selectedLineIdx int) error { func (self *PatchExplorerContext) NavigateTo(isFocused bool, selectedLineIdx int) {
self.GetState().SetLineSelectMode() self.GetState().SetLineSelectMode()
self.GetState().SelectLine(selectedLineIdx) self.GetState().SelectLine(selectedLineIdx)
return self.RenderAndFocus(isFocused) self.RenderAndFocus(isFocused)
} }
func (self *PatchExplorerContext) GetMutex() *deadlock.Mutex { func (self *PatchExplorerContext) GetMutex() *deadlock.Mutex {

View File

@ -329,7 +329,8 @@ func (self *MergeConflictsController) withRenderAndFocus(f func() error) func()
return err return err
} }
return self.context().RenderAndFocus() self.context().RenderAndFocus()
return nil
}) })
} }

View File

@ -300,7 +300,8 @@ func (self *PatchExplorerController) withRenderAndFocus(f func() error) func() e
return err return err
} }
return self.context.RenderAndFocus(self.isFocused()) self.context.RenderAndFocus(self.isFocused())
return nil
}) })
} }

View File

@ -133,8 +133,8 @@ func (self *StagingController) GetOnFocusLost() func(types.OnFocusLostOpts) erro
if opts.NewContextKey != self.otherContext.GetKey() { if opts.NewContextKey != self.otherContext.GetKey() {
self.c.Views().Staging.Wrap = true self.c.Views().Staging.Wrap = true
self.c.Views().StagingSecondary.Wrap = true self.c.Views().StagingSecondary.Wrap = true
_ = self.c.Contexts().Staging.Render(false) self.c.Contexts().Staging.Render(false)
_ = self.c.Contexts().StagingSecondary.Render(false) self.c.Contexts().StagingSecondary.Render(false)
} }
return nil return nil
} }

View File

@ -177,11 +177,11 @@ type IPatchExplorerContext interface {
GetState() *patch_exploring.State GetState() *patch_exploring.State
SetState(*patch_exploring.State) SetState(*patch_exploring.State)
GetIncludedLineIndices() []int GetIncludedLineIndices() []int
RenderAndFocus(isFocused bool) error RenderAndFocus(isFocused bool)
Render(isFocused bool) error Render(isFocused bool)
Focus() error Focus() error
GetContentToRender(isFocused bool) string GetContentToRender(isFocused bool) string
NavigateTo(isFocused bool, selectedLineIdx int) error NavigateTo(isFocused bool, selectedLineIdx int)
GetMutex() *deadlock.Mutex GetMutex() *deadlock.Mutex
IsPatchExplorerContext() // used for type switch IsPatchExplorerContext() // used for type switch
} }