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
()
| 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 |
| 110 | func (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 | |
| 130 | func (self *ListContextTrait) OnSearchSelect(selectedLineIdx int) { |
| 131 | self.GetList().SetSelection(self.ViewIndexToModelIndex(selectedLineIdx)) |
nothing calls this directly
no test coverage detected