aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2024-02-12 06:26:20 -0600
committerRobin Jarry <robin@jarry.cc>2024-02-12 13:48:50 +0100
commita60f2c19a0a962167067547c2a74988012cf2f44 (patch)
treee3c98d3d0f7ac934eb6ee0c4cb19b1a1377cc2a8 /app
parentcdc90afbaa1a6ff7d0900b6ce904a1e51e31bcd1 (diff)
downloadaerc-a60f2c19a0a962167067547c2a74988012cf2f44.tar.gz
style: use vaxis style everywhere
Replace all tcell.Style objects with vaxis.Style objects Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'app')
-rw-r--r--app/authinfo.go4
-rw-r--r--app/compose.go2
-rw-r--r--app/dirlist.go10
-rw-r--r--app/listbox.go5
-rw-r--r--app/msglist.go4
-rw-r--r--app/msgviewer.go5
-rw-r--r--app/partswitcher.go2
-rw-r--r--app/pgpinfo.go4
-rw-r--r--app/spinner.go5
-rw-r--r--app/status.go8
10 files changed, 23 insertions, 26 deletions
diff --git a/app/authinfo.go b/app/authinfo.go
index 982edcb2..d201aa8d 100644
--- a/app/authinfo.go
+++ b/app/authinfo.go
@@ -6,7 +6,7 @@ import (
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib/auth"
"git.sr.ht/~rjarry/aerc/lib/ui"
- "github.com/gdamore/tcell/v2"
+ "git.sr.ht/~rockorager/vaxis"
"github.com/mattn/go-runewidth"
)
@@ -36,7 +36,7 @@ func (a *AuthInfo) Draw(ctx *ui.Context) {
checkBounds := func(x int) bool {
return x < ctx.Width()
}
- setResult := func(result auth.Result) (string, tcell.Style) {
+ setResult := func(result auth.Result) (string, vaxis.Style) {
switch result {
case auth.ResultNone:
return "none", defaultStyle
diff --git a/app/compose.go b/app/compose.go
index d56f15eb..7bc3fd66 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, tcell.VaxisStyle(borderStyle))).At(2, 0)
+ grid.AddChild(ui.NewFill(borderChar, borderStyle)).At(2, 0)
if c.review != nil {
grid.AddChild(c.review).At(3, 0)
} else if c.editor != nil {
diff --git a/app/dirlist.go b/app/dirlist.go
index 53aeed9d..e9228374 100644
--- a/app/dirlist.go
+++ b/app/dirlist.go
@@ -295,12 +295,12 @@ func (dirlist *DirectoryList) Draw(ctx *ui.Context) {
func (dirlist *DirectoryList) renderDir(
path string, conf *config.UIConfig, data models.TemplateData,
selected bool, width int,
-) (string, string, tcell.Style) {
+) (string, string, vaxis.Style) {
var left, right string
var buf bytes.Buffer
var styles []config.StyleObject
- var style tcell.Style
+ var style vaxis.Style
r, u, _ := dirlist.GetRUECount(path)
if u > 0 {
@@ -353,7 +353,7 @@ func (dirlist *DirectoryList) renderDir(
left = lbuf.Truncate(lwidth-1, '…')
} else {
for i := 0; i < (width - lwidth - rwidth - 1); i += 1 {
- lbuf.Write(' ', tcell.StyleDefault)
+ lbuf.Write(' ', vaxis.Style{})
}
left = lbuf.String()
right = rbuf.String()
@@ -363,8 +363,8 @@ func (dirlist *DirectoryList) renderDir(
}
func (dirlist *DirectoryList) drawScrollbar(ctx *ui.Context) {
- gutterStyle := tcell.StyleDefault
- pillStyle := tcell.StyleDefault.Reverse(true)
+ gutterStyle := vaxis.Style{}
+ pillStyle := vaxis.Style{Attribute: vaxis.AttrReverse}
// gutter
ctx.Fill(0, 0, 1, ctx.Height(), ' ', gutterStyle)
diff --git a/app/listbox.go b/app/listbox.go
index f5250700..5568d36b 100644
--- a/app/listbox.go
+++ b/app/listbox.go
@@ -10,7 +10,6 @@ import (
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rockorager/vaxis"
- "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
)
@@ -212,8 +211,8 @@ func (lb *ListBox) drawBox(ctx *ui.Context) {
}
func (lb *ListBox) drawScrollbar(ctx *ui.Context) {
- gutterStyle := tcell.StyleDefault
- pillStyle := tcell.StyleDefault.Reverse(true)
+ gutterStyle := vaxis.Style{}
+ pillStyle := vaxis.Style{Attribute: vaxis.AttrReverse}
// gutter
h := ctx.Height()
diff --git a/app/msglist.go b/app/msglist.go
index 49529811..ac0012b4 100644
--- a/app/msglist.go
+++ b/app/msglist.go
@@ -124,8 +124,8 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
return false
}
- getRowStyle := func(t *ui.Table, r int) tcell.Style {
- var style tcell.Style
+ getRowStyle := func(t *ui.Table, r int) vaxis.Style {
+ var style vaxis.Style
row := &t.Rows[r]
params, _ := row.Priv.(messageRowParams)
if params.uid == store.SelectedUid() {
diff --git a/app/msgviewer.go b/app/msgviewer.go
index 179deca4..a22d2c15 100644
--- a/app/msgviewer.go
+++ b/app/msgviewer.go
@@ -13,7 +13,6 @@ 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"
@@ -146,10 +145,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, tcell.VaxisStyle(borderStyle))).At(2, 0)
+ grid.AddChild(ui.NewFill(borderChar, borderStyle)).At(2, 0)
grid.AddChild(switcher).At(3, 0)
} else {
- grid.AddChild(ui.NewFill(borderChar, tcell.VaxisStyle(borderStyle))).At(1, 0)
+ grid.AddChild(ui.NewFill(borderChar, borderStyle)).At(1, 0)
grid.AddChild(switcher).At(2, 0)
}
diff --git a/app/partswitcher.go b/app/partswitcher.go
index 8552d32b..5dc996f7 100644
--- a/app/partswitcher.go
+++ b/app/partswitcher.go
@@ -103,7 +103,7 @@ func (ps *PartSwitcher) Draw(ctx *ui.Context) {
ps.UpdateScroller(ps.height, n)
ps.EnsureScroll(ps.selected)
- var styleSwitcher, styleFile, styleMime tcell.Style
+ var styleSwitcher, styleFile, styleMime vaxis.Style
scrollbarWidth := 0
if ps.NeedScrollbar() {
diff --git a/app/pgpinfo.go b/app/pgpinfo.go
index d5bbc696..d2361a01 100644
--- a/app/pgpinfo.go
+++ b/app/pgpinfo.go
@@ -8,7 +8,7 @@ import (
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/models"
- "github.com/gdamore/tcell/v2"
+ "git.sr.ht/~rockorager/vaxis"
)
type PGPInfo struct {
@@ -27,7 +27,7 @@ func (p *PGPInfo) DrawSignature(ctx *ui.Context) {
defaultStyle := p.uiConfig.GetStyle(config.STYLE_DEFAULT)
var icon string
- var indicatorStyle, textstyle tcell.Style
+ var indicatorStyle, textstyle vaxis.Style
textstyle = defaultStyle
var indicatorText, messageText string
// TODO: Nicer prompt for TOFU, fetch from keyserver, etc
diff --git a/app/spinner.go b/app/spinner.go
index bcf8168a..2c675e3c 100644
--- a/app/spinner.go
+++ b/app/spinner.go
@@ -5,11 +5,10 @@ import (
"sync/atomic"
"time"
- "github.com/gdamore/tcell/v2"
-
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/log"
+ "git.sr.ht/~rockorager/vaxis"
)
type Spinner struct {
@@ -17,7 +16,7 @@ type Spinner struct {
frames []string
interval time.Duration
stop chan struct{}
- style tcell.Style
+ style vaxis.Style
}
func NewSpinner(uiConf *config.UIConfig) *Spinner {
diff --git a/app/status.go b/app/status.go
index dbedea7e..952a3b98 100644
--- a/app/status.go
+++ b/app/status.go
@@ -5,7 +5,6 @@ import (
"sync"
"time"
- "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
"git.sr.ht/~rjarry/aerc/config"
@@ -13,6 +12,7 @@ import (
"git.sr.ht/~rjarry/aerc/lib/templates"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/log"
+ "git.sr.ht/~rockorager/vaxis"
)
type StatusLine struct {
@@ -23,7 +23,7 @@ type StatusLine struct {
}
type StatusMessage struct {
- style tcell.Style
+ style vaxis.Style
message string
}
@@ -60,7 +60,7 @@ func (status *StatusLine) Draw(ctx *ui.Context) {
config.Statusline.StatusColumns,
config.Statusline.ColumnSeparator,
nil,
- func(*ui.Table, int) tcell.Style { return style },
+ func(*ui.Table, int) vaxis.Style { return style },
)
var buf bytes.Buffer
cells := make([]string, len(table.Columns))
@@ -156,6 +156,6 @@ func (status *StatusLine) uiConfig() *config.UIConfig {
return SelectedAccountUiConfig()
}
-func (msg *StatusMessage) Color(style tcell.Style) {
+func (msg *StatusMessage) Color(style vaxis.Style) {
msg.style = style
}