diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-20 21:27:01 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-20 21:27:01 +1000 |
commit | 6e247c1583d84b2a7e31e9a17fd57e08ae58e1b9 (patch) | |
tree | 514e0ea010c263762f2e47474cfb85ad144234d2 /pkg/gui/context/list_context_trait.go | |
parent | 1f920ae6ba781d5862b8bd66084c2a75da3f3076 (diff) | |
parent | 87bf1dbc7f1b600635c38065127853cd71f1dc18 (diff) |
Only apply right-alignment on first column of keybindings menu (#2801)v0.39.0
Diffstat (limited to 'pkg/gui/context/list_context_trait.go')
-rw-r--r-- | pkg/gui/context/list_context_trait.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/gui/context/list_context_trait.go b/pkg/gui/context/list_context_trait.go index de88d3d3b..54e3ab9ea 100644 --- a/pkg/gui/context/list_context_trait.go +++ b/pkg/gui/context/list_context_trait.go @@ -14,7 +14,7 @@ type ListContextTrait struct { list types.IList getDisplayStrings func(startIdx int, length int) [][]string // Alignment for each column. If nil, the default is left alignment - columnAlignments []utils.Alignment + getColumnAlignments func() []utils.Alignment // Some contexts, like the commit context, will highlight the path from the selected commit // to its parents, because it's ambiguous otherwise. For these, we need to refresh the viewport // so that we show the highlighted path. @@ -82,9 +82,13 @@ func (self *ListContextTrait) HandleFocusLost(opts types.OnFocusLostOpts) error // 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 func (self *ListContextTrait) HandleRender() error { self.list.RefreshSelectedIdx() + var columnAlignments []utils.Alignment + if self.getColumnAlignments != nil { + columnAlignments = self.getColumnAlignments() + } content := utils.RenderDisplayStrings( self.getDisplayStrings(0, self.list.Len()), - self.columnAlignments, + columnAlignments, ) self.GetViewTrait().SetContent(content) self.c.Render() |