diff options
author | Robin Jarry <robin@jarry.cc> | 2023-01-31 14:23:03 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-02-20 14:48:42 +0100 |
commit | 34db5942bd7b642107002b75de9d5d5c7fe90e4c (patch) | |
tree | c4da0bf758df1722a1f928dc01d493964985f5c5 /widgets/msglist.go | |
parent | 191876182a91659bbeab0c7b5c4ef61ebe636f76 (diff) | |
download | aerc-34db5942bd7b642107002b75de9d5d5c7fe90e4c.tar.gz |
ui/table: do not require width at construction
The width is only required when rendering the table in Draw. Remove the
redundant width attribute.
Fixes: 012be0192c88 ("ui: add reusable table widget")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'widgets/msglist.go')
-rw-r--r-- | widgets/msglist.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/widgets/msglist.go b/widgets/msglist.go index 4b2bf721..ab8b89fa 100644 --- a/widgets/msglist.go +++ b/widgets/msglist.go @@ -98,7 +98,7 @@ func (ml *MessageList) Draw(ctx *ui.Context) { params, _ := row.Priv.(messageRowParams) if params.needsHeaders { needsHeaders = append(needsHeaders, params.uid) - ml.spinner.Draw(ctx.Subcontext(0, r, t.Width, 1)) + ml.spinner.Draw(ctx.Subcontext(0, r, c.Width(), 1)) return true } return false @@ -119,7 +119,7 @@ func (ml *MessageList) Draw(ctx *ui.Context) { } table := ui.NewTable( - textWidth, ml.height, + ml.height, uiConfig.IndexColumns, uiConfig.ColumnSeparator, customDraw, @@ -185,10 +185,10 @@ func (ml *MessageList) Draw(ctx *ui.Context) { } } - table.Draw(ctx) + table.Draw(ctx.Subcontext(0, 0, textWidth, ctx.Height())) if ml.NeedScrollbar() { - scrollbarCtx := ctx.Subcontext(ctx.Width()-1, 0, 1, ctx.Height()) + scrollbarCtx := ctx.Subcontext(textWidth, 0, 1, ctx.Height()) ml.drawScrollbar(scrollbarCtx) } |