Skip to content

Commit f08b3e9

Browse files
committed
Cleanup: remove isFocused parameter from GetContentToRender and related methods
It became unused in f3eb180.
1 parent 8f3e59b commit f08b3e9

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

pkg/gui/context/patch_explorer_context.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func NewPatchExplorerContext(
5353
func(selectedLineIdx int) error {
5454
ctx.GetMutex().Lock()
5555
defer ctx.GetMutex().Unlock()
56-
ctx.NavigateTo(ctx.c.Context().IsCurrent(ctx), selectedLineIdx)
56+
ctx.NavigateTo(selectedLineIdx)
5757
return nil
5858
}),
5959
)
@@ -79,15 +79,15 @@ func (self *PatchExplorerContext) GetIncludedLineIndices() []int {
7979
return self.getIncludedLineIndices()
8080
}
8181

82-
func (self *PatchExplorerContext) RenderAndFocus(isFocused bool) {
83-
self.setContent(isFocused)
82+
func (self *PatchExplorerContext) RenderAndFocus() {
83+
self.setContent()
8484

8585
self.FocusSelection()
8686
self.c.Render()
8787
}
8888

89-
func (self *PatchExplorerContext) Render(isFocused bool) {
90-
self.setContent(isFocused)
89+
func (self *PatchExplorerContext) Render() {
90+
self.setContent()
9191

9292
self.c.Render()
9393
}
@@ -97,8 +97,8 @@ func (self *PatchExplorerContext) Focus() {
9797
self.c.Render()
9898
}
9999

100-
func (self *PatchExplorerContext) setContent(isFocused bool) {
101-
self.GetView().SetContent(self.GetContentToRender(isFocused))
100+
func (self *PatchExplorerContext) setContent() {
101+
self.GetView().SetContent(self.GetContentToRender())
102102
}
103103

104104
func (self *PatchExplorerContext) FocusSelection() {
@@ -119,19 +119,19 @@ func (self *PatchExplorerContext) FocusSelection() {
119119
view.SetCursorY(endIdx - newOriginY)
120120
}
121121

122-
func (self *PatchExplorerContext) GetContentToRender(isFocused bool) string {
122+
func (self *PatchExplorerContext) GetContentToRender() string {
123123
if self.GetState() == nil {
124124
return ""
125125
}
126126

127-
return self.GetState().RenderForLineIndices(isFocused, self.GetIncludedLineIndices())
127+
return self.GetState().RenderForLineIndices(self.GetIncludedLineIndices())
128128
}
129129

130-
func (self *PatchExplorerContext) NavigateTo(isFocused bool, selectedLineIdx int) {
130+
func (self *PatchExplorerContext) NavigateTo(selectedLineIdx int) {
131131
self.GetState().SetLineSelectMode()
132132
self.GetState().SelectLine(selectedLineIdx)
133133

134-
self.RenderAndFocus(isFocused)
134+
self.RenderAndFocus()
135135
}
136136

137137
func (self *PatchExplorerContext) GetMutex() *deadlock.Mutex {

pkg/gui/controllers/helpers/patch_building_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (self *PatchBuildingHelper) RefreshPatchBuildingPanel(opts types.OnFocusOpt
9898
return
9999
}
100100

101-
mainContent := context.GetContentToRender(true)
101+
mainContent := context.GetContentToRender()
102102

103103
self.c.Contexts().CustomPatchBuilder.FocusSelection()
104104

pkg/gui/controllers/helpers/staging_helper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ func (self *StagingHelper) RefreshStagingPanel(focusOpts types.OnFocusOpts) {
7373
mainState := mainContext.GetState()
7474
secondaryState := secondaryContext.GetState()
7575

76-
mainContent := mainContext.GetContentToRender(!secondaryFocused)
77-
secondaryContent := secondaryContext.GetContentToRender(secondaryFocused)
76+
mainContent := mainContext.GetContentToRender()
77+
secondaryContent := secondaryContext.GetContentToRender()
7878

7979
mainContext.GetMutex().Unlock()
8080
secondaryContext.GetMutex().Unlock()

pkg/gui/controllers/patch_explorer_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ func (self *PatchExplorerController) withRenderAndFocus(f func() error) func() e
302302
return err
303303
}
304304

305-
self.context.RenderAndFocus(self.isFocused())
305+
self.context.RenderAndFocus()
306306
return nil
307307
})
308308
}

pkg/gui/patch_exploring/state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func (s *State) AdjustSelectedLineIdx(change int) {
249249
s.SelectLine(s.selectedLineIdx + change)
250250
}
251251

252-
func (s *State) RenderForLineIndices(isFocused bool, includedLineIndices []int) string {
252+
func (s *State) RenderForLineIndices(includedLineIndices []int) string {
253253
includedLineIndicesSet := set.NewFromSlice(includedLineIndices)
254254
return s.patch.FormatView(patch.FormatViewOpts{
255255
IncLineIndices: includedLineIndicesSet,

pkg/gui/types/context.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,11 @@ type IPatchExplorerContext interface {
177177
GetState() *patch_exploring.State
178178
SetState(*patch_exploring.State)
179179
GetIncludedLineIndices() []int
180-
RenderAndFocus(isFocused bool)
181-
Render(isFocused bool)
180+
RenderAndFocus()
181+
Render()
182182
Focus()
183-
GetContentToRender(isFocused bool) string
184-
NavigateTo(isFocused bool, selectedLineIdx int)
183+
GetContentToRender() string
184+
NavigateTo(selectedLineIdx int)
185185
GetMutex() *deadlock.Mutex
186186
IsPatchExplorerContext() // used for type switch
187187
}

0 commit comments

Comments
 (0)