mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
Allow a list to render its footer elsewhere
The footer is drawn on the bottom border of the list's view, which is not always a free row: a panel that puts something else below the list shares that border with it, and has to render the footer there instead. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a9fe055af4
commit
f1b0347111
|
|
@ -28,6 +28,11 @@ type ListContextTrait struct {
|
|||
// true if we're inside the OnSearchSelect call; in that case we don't want to update the search
|
||||
// result index.
|
||||
inOnSearchSelect bool
|
||||
|
||||
// If set, this renders the "x of y" footer instead of the default, which puts
|
||||
// it on the bottom border of the list's own view. A list that is part of a
|
||||
// composite panel can use this to put it somewhere else; see MenuContext.
|
||||
renderFooter func(footer string)
|
||||
}
|
||||
|
||||
func (self *ListContextTrait) IsListContext() {}
|
||||
|
|
@ -81,7 +86,13 @@ func (self *ListContextTrait) refreshViewport() {
|
|||
}
|
||||
|
||||
func (self *ListContextTrait) setFooter() {
|
||||
self.GetViewTrait().SetFooter(formatListFooter(self.list.GetSelectedLineIdx(), self.list.Len()))
|
||||
footer := formatListFooter(self.list.GetSelectedLineIdx(), self.list.Len())
|
||||
if self.renderFooter != nil {
|
||||
self.renderFooter(footer)
|
||||
return
|
||||
}
|
||||
|
||||
self.GetViewTrait().SetFooter(footer)
|
||||
}
|
||||
|
||||
func formatListFooter(selectedLineIdx int, length int) string {
|
||||
|
|
|
|||
Loading…
Reference in a new issue