From f001f65240f85f0af91703dbcc0b068c0797297a Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Mon, 12 Feb 2024 06:26:18 -0600 Subject: fill: replace tcell.Style with vaxis.Style Replace the Fill implementation with vaxis style objects Signed-off-by: Tim Culverhouse Acked-by: Robin Jarry --- app/account-wizard.go | 2 +- app/aerc.go | 4 ++-- app/compose.go | 2 +- app/msgviewer.go | 5 +++-- lib/ui/context.go | 4 ++-- lib/ui/fill.go | 8 +++----- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/app/account-wizard.go b/app/account-wizard.go index e47acc53..0fd426ca 100644 --- a/app/account-wizard.go +++ b/app/account-wizard.go @@ -128,7 +128,7 @@ func (s *configStep) Grid() *ui.Grid { grid := ui.NewGrid().Rows(spec).Columns([]ui.GridSpec{justify}) intro := ui.NewText(introduction, config.Ui.GetStyle(config.STYLE_DEFAULT)) - fill := ui.NewFill(' ', tcell.StyleDefault) + fill := ui.NewFill(' ', vaxis.Style{}) grid.AddChild(fill).At(0, 0) grid.AddChild(intro).At(1, 0) diff --git a/app/aerc.go b/app/aerc.go index f4ad531a..0efaab30 100644 --- a/app/aerc.go +++ b/app/aerc.go @@ -881,9 +881,9 @@ func errorScreen(s string) ui.Drawable { }).Columns([]ui.GridSpec{ {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, }) - grid.AddChild(ui.NewFill(' ', tcell.StyleDefault)).At(0, 0) + grid.AddChild(ui.NewFill(' ', vaxis.Style{})).At(0, 0) grid.AddChild(text).At(1, 0) - grid.AddChild(ui.NewFill(' ', tcell.StyleDefault)).At(2, 0) + grid.AddChild(ui.NewFill(' ', vaxis.Style{})).At(2, 0) return grid } diff --git a/app/compose.go b/app/compose.go index 7bc3fd66..d56f15eb 100644 --- a/app/compose.go +++ b/app/compose.go @@ -1470,7 +1470,7 @@ func (c *Composer) updateGrid() { borderChar := c.acct.UiConfig().BorderCharHorizontal grid.AddChild(heditors).At(0, 0) grid.AddChild(c.crypto).At(1, 0) - grid.AddChild(ui.NewFill(borderChar, borderStyle)).At(2, 0) + grid.AddChild(ui.NewFill(borderChar, tcell.VaxisStyle(borderStyle))).At(2, 0) if c.review != nil { grid.AddChild(c.review).At(3, 0) } else if c.editor != nil { diff --git a/app/msgviewer.go b/app/msgviewer.go index a22d2c15..179deca4 100644 --- a/app/msgviewer.go +++ b/app/msgviewer.go @@ -13,6 +13,7 @@ import ( "github.com/danwakefield/fnmatch" "github.com/emersion/go-message/textproto" + "github.com/gdamore/tcell/v2" "github.com/mattn/go-runewidth" "git.sr.ht/~rjarry/aerc/config" @@ -145,10 +146,10 @@ func NewMessageViewer( grid.AddChild(header).At(0, 0) if msg.MessageDetails() != nil || acct.UiConfig().IconUnencrypted != "" { grid.AddChild(NewPGPInfo(msg.MessageDetails(), acct.UiConfig())).At(1, 0) - grid.AddChild(ui.NewFill(borderChar, borderStyle)).At(2, 0) + grid.AddChild(ui.NewFill(borderChar, tcell.VaxisStyle(borderStyle))).At(2, 0) grid.AddChild(switcher).At(3, 0) } else { - grid.AddChild(ui.NewFill(borderChar, borderStyle)).At(1, 0) + grid.AddChild(ui.NewFill(borderChar, tcell.VaxisStyle(borderStyle))).At(1, 0) grid.AddChild(switcher).At(2, 0) } diff --git a/lib/ui/context.go b/lib/ui/context.go index f1cc2a95..12621c8a 100644 --- a/lib/ui/context.go +++ b/lib/ui/context.go @@ -43,7 +43,7 @@ func (ctx *Context) Subcontext(x, y, width, height int) *Context { return &Context{win, x, y, ctx.onPopover} } -func (ctx *Context) SetCell(x, y int, ch rune, style tcell.Style) { +func (ctx *Context) SetCell(x, y int, ch rune, style vaxis.Style) { width, height := ctx.window.Size() if x >= width || y >= height { // no-op when dims are inadequate @@ -53,7 +53,7 @@ func (ctx *Context) SetCell(x, y int, ch rune, style tcell.Style) { Character: vaxis.Character{ Grapheme: string(ch), }, - Style: tcell.VaxisStyle(style), + Style: style, }) } diff --git a/lib/ui/fill.go b/lib/ui/fill.go index ff248905..eedb481e 100644 --- a/lib/ui/fill.go +++ b/lib/ui/fill.go @@ -1,15 +1,13 @@ package ui -import ( - "github.com/gdamore/tcell/v2" -) +import "git.sr.ht/~rockorager/vaxis" type Fill struct { Rune rune - Style tcell.Style + Style vaxis.Style } -func NewFill(f rune, s tcell.Style) Fill { +func NewFill(f rune, s vaxis.Style) Fill { return Fill{f, s} } -- cgit