MCPcopy
hub / github.com/jesseduffield/lazygit / HandleRender

Method HandleRender

pkg/gui/context/list_context_trait.go:110–128  ·  view source on GitHub ↗

OnFocus assumes that the content of the context has already been rendered to the view. OnRender is the function which actually renders the content to the view

()

Source from the content-addressed store, hash-verified

108
109// OnFocus assumes that the content of the context has already been rendered to the view. OnRender is the function which actually renders the content to the view
110func (self *ListContextTrait) HandleRender() {
111 self.list.ClampSelection()
112 if self.renderOnlyVisibleLines {
113 // Rendering only the visible area can save a lot of cell memory for
114 // those views that support it.
115 totalLength := self.list.Len()
116 if self.getNonModelItems != nil {
117 totalLength += len(self.getNonModelItems())
118 }
119 startIdx, length := self.GetViewTrait().ViewPortYBounds()
120 content := self.renderLines(startIdx, startIdx+length)
121 self.GetViewTrait().SetViewPortContentAndClearEverythingElse(totalLength, content)
122 self.needRerenderVisibleLines = false
123 } else {
124 content := self.renderLines(-1, -1)
125 self.GetViewTrait().SetContent(content)
126 }
127 self.setFooter()
128}
129
130func (self *ListContextTrait) OnSearchSelect(selectedLineIdx int) {
131 self.GetList().SetSelection(self.ViewIndexToModelIndex(selectedLineIdx))

Callers

nothing calls this directly

Calls 8

setFooterMethod · 0.95
renderLinesMethod · 0.80
ClampSelectionMethod · 0.65
LenMethod · 0.65
ViewPortYBoundsMethod · 0.65
GetViewTraitMethod · 0.65
SetContentMethod · 0.65

Tested by

no test coverage detected