compose: use account ui config where missing

The composer widget already has a reference to the AccountView object.
Get the UI config from it directly.

This completes commit 6edfbfa8ce ("aerc: use contextual ui styleset
for tabs/compose").

Fixes: https://todo.sr.ht/~rjarry/aerc/3
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Koni Marti <koni.marti@gmail.com>
This commit is contained in:
Robin Jarry 2022-04-28 15:28:11 +02:00
parent 01528ae1e2
commit 2f2a520ab0

View file

@ -124,7 +124,7 @@ func (c *Composer) buildComposeHeader(aerc *Aerc, cmpl *completer.Completer) {
c.layout = aerc.conf.Compose.HeaderLayout c.layout = aerc.conf.Compose.HeaderLayout
c.editors = make(map[string]*headerEditor) c.editors = make(map[string]*headerEditor)
c.focusable = make([]ui.MouseableDrawableInteractive, 0) c.focusable = make([]ui.MouseableDrawableInteractive, 0)
uiConfig := aerc.SelectedAccountUiConfig() uiConfig := c.acct.UiConfig()
for i, row := range c.layout { for i, row := range c.layout {
for j, h := range row { for j, h := range row {
@ -717,7 +717,7 @@ func (c *Composer) AddEditor(header string, value string, appendHeader bool) {
e.storeValue() // flush modifications from the user to the header e.storeValue() // flush modifications from the user to the header
editor = e editor = e
} else { } else {
uiConfig := c.aerc.SelectedAccountUiConfig() uiConfig := c.acct.UiConfig()
e := newHeaderEditor(header, c.header, uiConfig) e := newHeaderEditor(header, c.header, uiConfig)
if uiConfig.CompletionPopovers { if uiConfig.CompletionPopovers {
e.input.TabComplete(c.completer.ForHeader(header), uiConfig.CompletionDelay) e.input.TabComplete(c.completer.ForHeader(header), uiConfig.CompletionDelay)
@ -772,8 +772,8 @@ func (c *Composer) updateGrid() {
if c.heditors != nil { if c.heditors != nil {
c.grid.RemoveChild(c.heditors) c.grid.RemoveChild(c.heditors)
} }
borderStyle := c.config.Ui.GetStyle(config.STYLE_BORDER) borderStyle := c.acct.UiConfig().GetStyle(config.STYLE_BORDER)
borderChar := c.config.Ui.BorderCharHorizontal borderChar := c.acct.UiConfig().BorderCharHorizontal
c.heditors = heditors c.heditors = heditors
c.grid.AddChild(c.heditors).At(0, 0) c.grid.AddChild(c.heditors).At(0, 0)
c.grid.AddChild(ui.NewFill(borderChar, borderStyle)).At(1, 0) c.grid.AddChild(ui.NewFill(borderChar, borderStyle)).At(1, 0)
@ -970,7 +970,7 @@ func newReviewMessage(composer *Composer, err error) *reviewMessage {
{Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}) })
uiConfig := composer.config.Ui uiConfig := composer.acct.UiConfig()
if err != nil { if err != nil {
grid.AddChild(ui.NewText(err.Error(), uiConfig.GetStyle(config.STYLE_ERROR))) grid.AddChild(ui.NewText(err.Error(), uiConfig.GetStyle(config.STYLE_ERROR)))