mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-09 09:22:48 +03:00
Cleanup: remove isFocused parameter from GetContentToRender and related methods
It became unused in f3eb180f75
.
This commit is contained in:
@@ -53,7 +53,7 @@ func NewPatchExplorerContext(
|
|||||||
func(selectedLineIdx int) error {
|
func(selectedLineIdx int) error {
|
||||||
ctx.GetMutex().Lock()
|
ctx.GetMutex().Lock()
|
||||||
defer ctx.GetMutex().Unlock()
|
defer ctx.GetMutex().Unlock()
|
||||||
ctx.NavigateTo(ctx.c.Context().IsCurrent(ctx), selectedLineIdx)
|
ctx.NavigateTo(selectedLineIdx)
|
||||||
return nil
|
return nil
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
@@ -79,15 +79,15 @@ func (self *PatchExplorerContext) GetIncludedLineIndices() []int {
|
|||||||
return self.getIncludedLineIndices()
|
return self.getIncludedLineIndices()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *PatchExplorerContext) RenderAndFocus(isFocused bool) {
|
func (self *PatchExplorerContext) RenderAndFocus() {
|
||||||
self.setContent(isFocused)
|
self.setContent()
|
||||||
|
|
||||||
self.FocusSelection()
|
self.FocusSelection()
|
||||||
self.c.Render()
|
self.c.Render()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *PatchExplorerContext) Render(isFocused bool) {
|
func (self *PatchExplorerContext) Render() {
|
||||||
self.setContent(isFocused)
|
self.setContent()
|
||||||
|
|
||||||
self.c.Render()
|
self.c.Render()
|
||||||
}
|
}
|
||||||
@@ -97,8 +97,8 @@ func (self *PatchExplorerContext) Focus() {
|
|||||||
self.c.Render()
|
self.c.Render()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *PatchExplorerContext) setContent(isFocused bool) {
|
func (self *PatchExplorerContext) setContent() {
|
||||||
self.GetView().SetContent(self.GetContentToRender(isFocused))
|
self.GetView().SetContent(self.GetContentToRender())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *PatchExplorerContext) FocusSelection() {
|
func (self *PatchExplorerContext) FocusSelection() {
|
||||||
@@ -119,19 +119,19 @@ func (self *PatchExplorerContext) FocusSelection() {
|
|||||||
view.SetCursorY(endIdx - newOriginY)
|
view.SetCursorY(endIdx - newOriginY)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *PatchExplorerContext) GetContentToRender(isFocused bool) string {
|
func (self *PatchExplorerContext) GetContentToRender() string {
|
||||||
if self.GetState() == nil {
|
if self.GetState() == nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
return self.GetState().RenderForLineIndices(isFocused, self.GetIncludedLineIndices())
|
return self.GetState().RenderForLineIndices(self.GetIncludedLineIndices())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *PatchExplorerContext) NavigateTo(isFocused bool, selectedLineIdx int) {
|
func (self *PatchExplorerContext) NavigateTo(selectedLineIdx int) {
|
||||||
self.GetState().SetLineSelectMode()
|
self.GetState().SetLineSelectMode()
|
||||||
self.GetState().SelectLine(selectedLineIdx)
|
self.GetState().SelectLine(selectedLineIdx)
|
||||||
|
|
||||||
self.RenderAndFocus(isFocused)
|
self.RenderAndFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *PatchExplorerContext) GetMutex() *deadlock.Mutex {
|
func (self *PatchExplorerContext) GetMutex() *deadlock.Mutex {
|
||||||
|
@@ -98,7 +98,7 @@ func (self *PatchBuildingHelper) RefreshPatchBuildingPanel(opts types.OnFocusOpt
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
mainContent := context.GetContentToRender(true)
|
mainContent := context.GetContentToRender()
|
||||||
|
|
||||||
self.c.Contexts().CustomPatchBuilder.FocusSelection()
|
self.c.Contexts().CustomPatchBuilder.FocusSelection()
|
||||||
|
|
||||||
|
@@ -73,8 +73,8 @@ func (self *StagingHelper) RefreshStagingPanel(focusOpts types.OnFocusOpts) {
|
|||||||
mainState := mainContext.GetState()
|
mainState := mainContext.GetState()
|
||||||
secondaryState := secondaryContext.GetState()
|
secondaryState := secondaryContext.GetState()
|
||||||
|
|
||||||
mainContent := mainContext.GetContentToRender(!secondaryFocused)
|
mainContent := mainContext.GetContentToRender()
|
||||||
secondaryContent := secondaryContext.GetContentToRender(secondaryFocused)
|
secondaryContent := secondaryContext.GetContentToRender()
|
||||||
|
|
||||||
mainContext.GetMutex().Unlock()
|
mainContext.GetMutex().Unlock()
|
||||||
secondaryContext.GetMutex().Unlock()
|
secondaryContext.GetMutex().Unlock()
|
||||||
|
@@ -302,7 +302,7 @@ func (self *PatchExplorerController) withRenderAndFocus(f func() error) func() e
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
self.context.RenderAndFocus(self.isFocused())
|
self.context.RenderAndFocus()
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -249,7 +249,7 @@ func (s *State) AdjustSelectedLineIdx(change int) {
|
|||||||
s.SelectLine(s.selectedLineIdx + change)
|
s.SelectLine(s.selectedLineIdx + change)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *State) RenderForLineIndices(isFocused bool, includedLineIndices []int) string {
|
func (s *State) RenderForLineIndices(includedLineIndices []int) string {
|
||||||
includedLineIndicesSet := set.NewFromSlice(includedLineIndices)
|
includedLineIndicesSet := set.NewFromSlice(includedLineIndices)
|
||||||
return s.patch.FormatView(patch.FormatViewOpts{
|
return s.patch.FormatView(patch.FormatViewOpts{
|
||||||
IncLineIndices: includedLineIndicesSet,
|
IncLineIndices: includedLineIndicesSet,
|
||||||
|
@@ -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)
|
RenderAndFocus()
|
||||||
Render(isFocused bool)
|
Render()
|
||||||
Focus()
|
Focus()
|
||||||
GetContentToRender(isFocused bool) string
|
GetContentToRender() string
|
||||||
NavigateTo(isFocused bool, selectedLineIdx int)
|
NavigateTo(selectedLineIdx int)
|
||||||
GetMutex() *deadlock.Mutex
|
GetMutex() *deadlock.Mutex
|
||||||
IsPatchExplorerContext() // used for type switch
|
IsPatchExplorerContext() // used for type switch
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user